diff --git a/.github/workflows/lint-test-chart.yaml b/.github/workflows/lint-test-chart.yaml index 115099c..6e51b70 100644 --- a/.github/workflows/lint-test-chart.yaml +++ b/.github/workflows/lint-test-chart.yaml @@ -43,4 +43,4 @@ jobs: - name: Run chart-testing (install) if: steps.list-changed.outputs.changed == 'true' - run: ct install --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args '--set agent.url=https://scalr.test --set agent.token=foo' \ No newline at end of file + run: ct install --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args '--set agent.url=https://scalr.test --set agent.token=foo' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c3fead4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.ct diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..fd16ba2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files diff --git a/Makefile b/Makefile index 2457a21..8ea0b44 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,104 @@ .PHONY: docs +# Configure development environment +platform = $(shell uname -s) +arch = $(shell uname -m) +ct_version = 3.8.0 +kelik = "\\xF0\\x9F\\x8D\\xBA" + +dev: +# Prerequisites + if [ "$(platform)" = "Linux" ]; then \ + which curl >/dev/null || { apt-get update -yq && apt-get install -yq curl; }; \ + elif [ "$(platform)" = "Darwin" ]; then \ + which brew >/dev/null || { echo "Missing requirement: brew. Install Homebrew https://brew.sh/"; exit 1; } \ + fi; +# Install [helm](https://github.com/helm/helm#install) + version=3.12.0; \ + set -e; \ + echo "=> Installing helm..."; \ + case $(arch) in \ + x86_64) normarch="amd64" ;; \ + aarch64|arm64) normarch="arm64" ;; \ + *) echo "Unsupported architecture: $(arch)"; exit 1 ;; \ + esac; \ + \ + if [ "$(platform)" = "Linux" ]; then \ + curl -sSLo helm.tar.gz \ + https://get.helm.sh/helm-v$${version}-linux-$${normarch}.tar.gz \ + && tar -xz -C /usr/local/bin -f helm.tar.gz --strip-components 1 linux-$${normarch}/helm \ + && chmod +x /usr/local/bin/helm \ + && rm -f helm.tar.gz; \ + elif [ "$(platform)" = "Darwin" ]; then \ + brew install helm; \ + else \ + echo "Unsupported platform: $(platform)" \ + && exit 1; \ + fi; \ + helm version; \ + echo "$(kelik) Installed helm"; +# Install [helm-docs](https://github.com/norwoodj/helm-docs#installation) + version="1.11.0"; \ + set -e; \ + echo "=> Installing helm-docs..."; \ + case $(arch) in \ + x86_64) normarch=$(arch) ;; \ + aarch64|arm64) normarch="arm64" ;; \ + *) echo "Unsupported architecture: $(arch)"; exit 1 ;; \ + esac; \ + \ + if [ "$(platform)" = "Linux" ]; then \ + curl -sSLo helm-docs.tar.gz \ + https://github.com/norwoodj/helm-docs/releases/download/v$${version}/helm-docs_$${version}_$(platform)_$${normarch}.tar.gz \ + && tar -xz -C /usr/local/bin -f helm-docs.tar.gz helm-docs \ + && chmod +x /usr/local/bin/helm-docs \ + && rm -f helm-docs.tar.gz; \ + elif [ "$(platform)" = "Darwin" ]; then \ + brew install norwoodj/tap/helm-docs; \ + else \ + echo "Unsupported platform: $(platform)" \ + && exit 1; \ + fi; \ + helm-docs --version; \ + echo "$(kelik) Installed helm-docs"; +# Install [chart-testing](https://github.com/helm/chart-testing#installation) + set -e; \ + echo "=> Installing chart-testing..."; \ + case $(arch) in \ + x86_64) normarch="amd64" ;; \ + aarch64|arm64) normarch="arm64" ;; \ + *) echo "Unsupported architecture: $(arch)"; exit 1 ;; \ + esac; \ + \ + if [ "$(platform)" = "Linux" ]; then \ + curl -sSLo chart-testing.tar.gz \ + https://github.com/helm/chart-testing/releases/download/v$(ct_version)/chart-testing_$(ct_version)_$(platform)_$${normarch}.tar.gz \ + && tar -xz -C /usr/local/bin -f chart-testing.tar.gz ct \ + && chmod +x /usr/local/bin/ct \ + && rm -f chart-testing.tar.gz; \ + elif [ "$(platform)" = "Darwin" ]; then \ + brew install chart-testing; \ + else \ + echo "Unsupported platform: $(platform)" \ + && exit 1; \ + fi; \ + ct version; \ + echo "$(kelik) Installed chart-testing"; +# Importing ct config from the chart-testing repository. + set -e; \ + echo "=> Importing ct config..."; \ + ct_config_dir=".ct"; \ + mkdir -p $$ct_config_dir; \ + cd $$ct_config_dir; \ + curl -sSLO https://raw.githubusercontent.com/helm/chart-testing/v$(ct_version)/etc/chart_schema.yaml; \ + curl -sSLO https://raw.githubusercontent.com/helm/chart-testing/v$(ct_version)/etc/lintconf.yaml; \ + cd -; + echo "$(kelik) Imported ct config"; + # Generate documentation using helm-docs docs: helm-docs + +# Linting +lint: + env CT_CONFIG=.ct ct lint diff --git a/README.md b/README.md index 4509bb3..c22fb86 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ helm repo add scalr-agent-helm https://scalr.github.io/agent-helm/ You can then run `helm search repo scalr-agent-helm` to see the charts. -## Releasing +## Releasing Bump the version in `Chart.yaml`, commit and push. -> **Warning** +> **Warning** > do not create a tag yourself! GitHub Action release workflow will then using [Helm chart releaser](https://github.com/helm/chart-releaser-action) @@ -27,7 +27,7 @@ GitHub Action release workflow will then using [Helm chart releaser](https://git * commit an updated index.yaml with the new release * redeploy the GitHub pages to serve the new index.yaml -> **Note** +> **Note** > there might be a slight delay between the release and the `index.yaml` update, as GitHub pages have to be re-deployed. diff --git a/charts/agent-docker/CHANGELOG.md b/charts/agent-docker/CHANGELOG.md index 1369b4c..d94abac 100644 --- a/charts/agent-docker/CHANGELOG.md +++ b/charts/agent-docker/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] +## [v0.3.1] + +### Added +- Chart description +- Kubernetes deployment diagram + ## [v0.3.0] ### Updated diff --git a/charts/agent-docker/Chart.yaml b/charts/agent-docker/Chart.yaml index 6363065..99f7742 100644 --- a/charts/agent-docker/Chart.yaml +++ b/charts/agent-docker/Chart.yaml @@ -1,8 +1,19 @@ apiVersion: v2 name: agent-docker -description: Scalr agent for a self-hosted pool. +description: | + A Helm chart for the scalr-agent deployment on ths Kubernetes cluster, + where runs are executed in [dind](https://hub.docker.com/_/docker) sidecar container. + Run phases are isolated into docker containers. + + Kuberentes deployment doesn't scale on multiple replicas. + Consequently, the capacity of compute resources that can be managed + by a single agent remains constrained by a single node. + + Multiple Deployments can be created within a single Kubernetes cluster. + + ![Agent in Docker deployment diagram](/charts/agent-docker/assets/agent-docker-deploy-diagram.jpg) type: application -version: 0.3.0 +version: 0.3.1 appVersion: "0.1.33" home: https://github.com/Scalr/agent-helm/tree/master/charts/agent-docker maintainers: diff --git a/charts/agent-docker/README.md b/charts/agent-docker/README.md index 2914d31..38b404c 100644 --- a/charts/agent-docker/README.md +++ b/charts/agent-docker/README.md @@ -1,8 +1,18 @@ # agent-docker -![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.33](https://img.shields.io/badge/AppVersion-0.1.33-informational?style=flat-square) +![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.33](https://img.shields.io/badge/AppVersion-0.1.33-informational?style=flat-square) -Scalr agent for a self-hosted pool. +A Helm chart for the scalr-agent deployment on ths Kubernetes cluster, +where runs are executed in [dind](https://hub.docker.com/_/docker) sidecar container. +Run phases are isolated into docker containers. + +Kuberentes deployment doesn't scale on multiple replicas. +Consequently, the capacity of compute resources that can be managed +by a single agent remains constrained by a single node. + +Multiple Deployments can be created within a single Kubernetes cluster. + +![Agent in Docker deployment diagram](/charts/agent-docker/assets/agent-docker-deploy-diagram.jpg) **Homepage:** diff --git a/charts/agent-docker/assets/agent-docker-deploy-diagram.jpg b/charts/agent-docker/assets/agent-docker-deploy-diagram.jpg new file mode 100644 index 0000000..5b1bd2b Binary files /dev/null and b/charts/agent-docker/assets/agent-docker-deploy-diagram.jpg differ diff --git a/charts/agent-docker/values.yaml b/charts/agent-docker/values.yaml index cdb7a8d..2847587 100644 --- a/charts/agent-docker/values.yaml +++ b/charts/agent-docker/values.yaml @@ -73,4 +73,4 @@ resources: memory: 2048Mi requests: cpu: 500m - memory: 2048Mi \ No newline at end of file + memory: 2048Mi diff --git a/charts/agent-k8s/CHANGELOG.md b/charts/agent-k8s/CHANGELOG.md index 532af28..b398441 100644 --- a/charts/agent-k8s/CHANGELOG.md +++ b/charts/agent-k8s/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] +## [v0.2.1] + +### Added +- Chart description +- Kubernetes deployment diagram + ## [v0.2.0] ### Added diff --git a/charts/agent-k8s/Chart.yaml b/charts/agent-k8s/Chart.yaml index f54b584..a190613 100644 --- a/charts/agent-k8s/Chart.yaml +++ b/charts/agent-k8s/Chart.yaml @@ -1,8 +1,20 @@ apiVersion: v2 name: agent-k8s -description: A Helm chart for the Scalr Agent deployment on the Kubernetes cluster. +description: | + A Helm chart for the scalr-agent deployment on the Kubernetes cluster, + where runs are executed in Pods in the same cluster. + Run phases are isolated in kubernetes containers with resource limits. + + Agent pool DaemomSet scales up/down with the cluster, registering + and deregistering agents from the pool. When an Agent receives a job from Scalr, + it schedules a Pod for execution. The Kubernetes workload scheduler assigns the Pod + to a specific Node, where the Agent running on that Node oversees the execution + of the job. By enabling the Kubernetes auto-scaler, Terraform workloads can scale + linearly based on the load. + + ![Agent in Kubernetes deployment diagram](/charts/agent-k8s/assets/agent-k8s-deploy-diagram.jpg) type: application -version: 0.2.0 +version: 0.2.1 appVersion: "0.1.33" home: https://github.com/Scalr/agent-helm/tree/master/charts/agent-k8s maintainers: diff --git a/charts/agent-k8s/README.md b/charts/agent-k8s/README.md index 42f83fb..8fd3d0a 100644 --- a/charts/agent-k8s/README.md +++ b/charts/agent-k8s/README.md @@ -1,8 +1,19 @@ # agent-k8s -![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.33](https://img.shields.io/badge/AppVersion-0.1.33-informational?style=flat-square) +![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.33](https://img.shields.io/badge/AppVersion-0.1.33-informational?style=flat-square) -A Helm chart for the Scalr Agent deployment on the Kubernetes cluster. +A Helm chart for the scalr-agent deployment on the Kubernetes cluster, +where runs are executed in Pods in the same cluster. +Run phases are isolated in kubernetes containers with resource limits. + +Agent pool DaemomSet scales up/down with the cluster, registering +and deregistering agents from the pool. When an Agent receives a job from Scalr, +it schedules a Pod for execution. The Kubernetes workload scheduler assigns the Pod +to a specific Node, where the Agent running on that Node oversees the execution +of the job. By enabling the Kubernetes auto-scaler, Terraform workloads can scale +linearly based on the load. + +![Agent in Kubernetes deployment diagram](/charts/agent-k8s/assets/agent-k8s-deploy-diagram.jpg) **Homepage:** diff --git a/charts/agent-k8s/assets/agent-k8s-deploy-diagram.jpg b/charts/agent-k8s/assets/agent-k8s-deploy-diagram.jpg new file mode 100644 index 0000000..2f9f677 Binary files /dev/null and b/charts/agent-k8s/assets/agent-k8s-deploy-diagram.jpg differ