From 61ef0d1e5ae3736c3da630a5657e73a3e0daa29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 30 Nov 2022 18:02:46 +0100 Subject: [PATCH 1/5] feat: add helm release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .github/workflows/helm-lint.yaml | 2 -- .github/workflows/release.yaml | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/helm-lint.yaml b/.github/workflows/helm-lint.yaml index 07b2f11..5b17d4f 100644 --- a/.github/workflows/helm-lint.yaml +++ b/.github/workflows/helm-lint.yaml @@ -19,8 +19,6 @@ jobs: run: git fetch --prune --unshallow - name: Set up Helm uses: azure/setup-helm@v3 - with: - version: v3.10.0 - uses: actions/setup-python@v4 with: python-version: 3.7 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7b8d1aa..456190c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,6 +19,8 @@ jobs: uses: actions/setup-go@v3 with: go-version-file: go.mod + - name: Install Helm + uses: azure/setup-helm@v3 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v3 with: From e88269d6b6d417ec7add46339fd54c675937ce04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 30 Nov 2022 18:11:32 +0100 Subject: [PATCH 2/5] adapt chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- charts/kyverno-aws-adapter/Chart.yaml | 4 ++-- charts/kyverno-aws-adapter/templates/_helpers.tpl | 4 ++++ charts/kyverno-aws-adapter/templates/deployment.yaml | 2 +- charts/kyverno-aws-adapter/values.yaml | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/charts/kyverno-aws-adapter/Chart.yaml b/charts/kyverno-aws-adapter/Chart.yaml index 049c678..10ed4f0 100644 --- a/charts/kyverno-aws-adapter/Chart.yaml +++ b/charts/kyverno-aws-adapter/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: kyverno-aws-adapter description: Helm chart for the Kyverno AWS Adapter type: application -version: 0.1.0 -appVersion: 0.1.0 +version: v0.0.1 +appVersion: v0.0.1 keywords: - kubernetes - nirmata diff --git a/charts/kyverno-aws-adapter/templates/_helpers.tpl b/charts/kyverno-aws-adapter/templates/_helpers.tpl index 5ca9fc9..e88f966 100644 --- a/charts/kyverno-aws-adapter/templates/_helpers.tpl +++ b/charts/kyverno-aws-adapter/templates/_helpers.tpl @@ -66,3 +66,7 @@ Generate the dockerconfigjson value {{- $user_pwd_hashed := printf "%s:%s" .Values.registryConfig.username .Values.registryConfig.password | b64enc }} {{- printf "{\"auths\":{\"ghcr.io\":{\"auth\":\"%s\"}}}" $user_pwd_hashed | b64enc }} {{- end }} + +{{- define "kyverno-aws-adapter.image" -}} +{{ printf "%s:%s" (required "An image repository is required" .Values.image.repository) (default .Chart.AppVersion .Values.image.tag) }} +{{- end }} diff --git a/charts/kyverno-aws-adapter/templates/deployment.yaml b/charts/kyverno-aws-adapter/templates/deployment.yaml index c3c4118..8691344 100644 --- a/charts/kyverno-aws-adapter/templates/deployment.yaml +++ b/charts/kyverno-aws-adapter/templates/deployment.yaml @@ -28,7 +28,7 @@ spec: containers: - command: - /manager - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: {{ include "kyverno-aws-adapter.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} name: manager {{- if .Values.pollInterval }} diff --git a/charts/kyverno-aws-adapter/values.yaml b/charts/kyverno-aws-adapter/values.yaml index 25200be..77f1a3d 100644 --- a/charts/kyverno-aws-adapter/values.yaml +++ b/charts/kyverno-aws-adapter/values.yaml @@ -39,5 +39,5 @@ image: repository: ghcr.io/nirmata/kyverno-aws-adapter # -- Image pull policy pullPolicy: Always - # -- Image tag - tag: latest + # -- Image tag (defaults to chart app version) + tag: From f8d02b1779c1400d757c59c627c9119fcad187c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 30 Nov 2022 18:29:23 +0100 Subject: [PATCH 3/5] package charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .github/workflows/release.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 456190c..21fbebd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,3 +33,21 @@ jobs: set -e echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin IMG="$IMG_REPOSITORY:${{ github.ref_name }}" make docker-buildx + - name: Create charts tmp directory + run: | + mkdir charts-tmp + cp -a charts/kyverno-aws-adapter charts-tmp/kyverno-aws-adapter + - name: Package charts + run: | + for dir in `find charts-tmp -maxdepth 1 -mindepth 1 -type d -print`; do + chart=${dir##*/} + echo "Found chart: ${chart}" + helm package charts-tmp/${chart} --destination --version ${{ github.ref_name }} --app-version ${{ github.ref_name }} .helm-dist + done + # - name: Run chart-releaser + # uses: helm/chart-releaser-action@v1.4.1 + # with: + # charts_dir: .helm-dist + # skip_packaging: true + # env: + # CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 34bd47a1d047dbd20814198ffaef55b8036fefab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 30 Nov 2022 18:29:37 +0100 Subject: [PATCH 4/5] package charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .github/workflows/release.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 21fbebd..8587bcc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -44,10 +44,10 @@ jobs: echo "Found chart: ${chart}" helm package charts-tmp/${chart} --destination --version ${{ github.ref_name }} --app-version ${{ github.ref_name }} .helm-dist done - # - name: Run chart-releaser - # uses: helm/chart-releaser-action@v1.4.1 - # with: - # charts_dir: .helm-dist - # skip_packaging: true - # env: - # CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.4.1 + with: + charts_dir: .helm-dist + skip_packaging: true + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From deeb1eb81871ad0cd40411ccd3598bb00a34077e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Wed, 30 Nov 2022 18:31:46 +0100 Subject: [PATCH 5/5] fix docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- charts/kyverno-aws-adapter/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/kyverno-aws-adapter/README.md b/charts/kyverno-aws-adapter/README.md index 49e10f7..f085514 100644 --- a/charts/kyverno-aws-adapter/README.md +++ b/charts/kyverno-aws-adapter/README.md @@ -2,7 +2,7 @@ Helm chart for the Kyverno AWS Adapter -![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.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square) +![Version: v0.0.1](https://img.shields.io/badge/Version-v0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.0.1](https://img.shields.io/badge/AppVersion-v0.0.1-informational?style=flat-square) ## Description @@ -40,7 +40,7 @@ You’ll need an [EKS](https://aws.amazon.com/eks/) cluster to run against. | rbac.serviceAccount.name | string | `nil` | Service account name, you MUST provide one when `rbac.create` is set to `false` | | image.repository | string | `"ghcr.io/nirmata/kyverno-aws-adapter"` | Image repository | | image.pullPolicy | string | `"Always"` | Image pull policy | -| image.tag | string | `"latest"` | Image tag | +| image.tag | string | `nil` | Image tag (defaults to chart app version) | ## IAM Role for Service Account