From f7a00b75579ebbdb622cbe887fde91a64cee20d9 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 21 Oct 2024 13:39:37 +0200 Subject: [PATCH 1/9] fix: corrected serviceaccount creation --- deployments/chart/Chart.yaml | 4 ++-- deployments/chart/templates/serviceaccount.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/deployments/chart/Chart.yaml b/deployments/chart/Chart.yaml index a1540a0..1ce8ea3 100644 --- a/deployments/chart/Chart.yaml +++ b/deployments/chart/Chart.yaml @@ -6,8 +6,8 @@ keywords: - kube-downscaler - go - downscaling -version: 1.1.1 -appVersion: 1.1.1 +version: 1.1.2 +appVersion: 1.1.2 icon: https://raw.githubusercontent.com/caas-team/GoKubeDownscaler/refs/heads/main/deployments/chart/icon.svg sources: - https://github.com/caas-team/GoKubeDownscaler diff --git a/deployments/chart/templates/serviceaccount.yaml b/deployments/chart/templates/serviceaccount.yaml index 726dc7c..f5bfa87 100644 --- a/deployments/chart/templates/serviceaccount.yaml +++ b/deployments/chart/templates/serviceaccount.yaml @@ -1,4 +1,6 @@ +{{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "go-kube-downscaler.serviceAccountName" . }} +{{- end }} \ No newline at end of file From 167206945fcbca51239a6565c95afb4267aa39b5 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 11:40:18 +0000 Subject: [PATCH 2/9] chore: automatically push pre-commit changes --- deployments/chart/templates/serviceaccount.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/chart/templates/serviceaccount.yaml b/deployments/chart/templates/serviceaccount.yaml index f5bfa87..24459f9 100644 --- a/deployments/chart/templates/serviceaccount.yaml +++ b/deployments/chart/templates/serviceaccount.yaml @@ -3,4 +3,4 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "go-kube-downscaler.serviceAccountName" . }} -{{- end }} \ No newline at end of file +{{- end }} From 64a0d5d4e73dd220c08f89168b2d92c24a29bd48 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 21 Oct 2024 13:43:51 +0200 Subject: [PATCH 3/9] chore: changed urls --- deployments/chart/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployments/chart/Chart.yaml b/deployments/chart/Chart.yaml index 1ce8ea3..e8283bf 100644 --- a/deployments/chart/Chart.yaml +++ b/deployments/chart/Chart.yaml @@ -14,7 +14,7 @@ sources: maintainers: - name: jonathan-mayer email: jonathan.mayer@telekom.de - url: https://www.telekom.com + url: https://github.com/jonathan-mayer - name: JTaeuber email: jan.taeuber@telekom.de - url: https://www.telekom.com + url: https://github.com/JTaeuber From cf92f77d1c40dd985f566201aea2c30a78a34137 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 21 Oct 2024 15:14:50 +0200 Subject: [PATCH 4/9] revert to 1.1.1 --- deployments/chart/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployments/chart/Chart.yaml b/deployments/chart/Chart.yaml index e8283bf..e58d274 100644 --- a/deployments/chart/Chart.yaml +++ b/deployments/chart/Chart.yaml @@ -6,8 +6,8 @@ keywords: - kube-downscaler - go - downscaling -version: 1.1.2 -appVersion: 1.1.2 +version: 1.1.1 +appVersion: 1.1.1 icon: https://raw.githubusercontent.com/caas-team/GoKubeDownscaler/refs/heads/main/deployments/chart/icon.svg sources: - https://github.com/caas-team/GoKubeDownscaler From 2dc166699ba94eecf8d8faa6c5730a4217507dea Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 21 Oct 2024 15:41:07 +0200 Subject: [PATCH 5/9] feat: add dev build workflow --- .github/workflows/create_dev_build.yaml | 28 +++++++++++++++++++++++++ .github/workflows/docker_build.yaml | 17 +++++++++++++-- .github/workflows/helm_build.yaml | 15 ++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/create_dev_build.yaml diff --git a/.github/workflows/create_dev_build.yaml b/.github/workflows/create_dev_build.yaml new file mode 100644 index 0000000..8c6a0be --- /dev/null +++ b/.github/workflows/create_dev_build.yaml @@ -0,0 +1,28 @@ +name: Create dev build + +on: + workflow_dispatch: + +jobs: + create_dev_build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract Chart Version + id: chart_version + run: | + version=$(yq e '.version' ./test-chart/Chart.yaml) + echo "version=$version" >> $GITHUB_ENV + + - name: Dispatch event to create dev build + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + repository: caas-team/GoKubeDownscaler + event-type: create-dev-build + client-payload: '{"version": "${{ env.version }}-dev"}' diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml index 2004390..e249e3d 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/docker_build.yaml @@ -2,7 +2,7 @@ name: Build and push Image on: repository_dispatch: - types: [release-new-version] + types: [release-new-version, create-dev-build] jobs: build: @@ -13,6 +13,7 @@ jobs: - name: Docker meta id: meta + if: github.event.action == 'release-new-version' uses: docker/metadata-action@v5 with: images: | @@ -22,6 +23,16 @@ jobs: latest ${{ github.event.client_payload.appVersion }} + - name: Dev docker meta + id: dev-meta + if: github.event.action == 'create-dev-build' + uses: docker/metadata-action@v5 + with: + images: | + mtr.devops.telekom.de/caas/go-kube-downscaler + ghcr.io/caas-team/gokubedownscaler + tags: dev + - name: Install Cosign uses: sigstore/cosign-installer@main with: @@ -54,7 +65,9 @@ jobs: context: . platforms: linux/amd64 push: true - tags: ${{ steps.meta.outputs.tags }} + tags: | + ${{ steps.meta.outputs.tags }} + ${{ steps.dev-meta.outputs.tags }} - name: Sign Push run: | diff --git a/.github/workflows/helm_build.yaml b/.github/workflows/helm_build.yaml index 03177a3..cc480dc 100644 --- a/.github/workflows/helm_build.yaml +++ b/.github/workflows/helm_build.yaml @@ -2,7 +2,7 @@ name: Build and push helm chart on: repository_dispatch: - types: [build-new-chart] + types: [build-new-chart, create-dev-build] jobs: build_and_push: @@ -26,6 +26,7 @@ jobs: MTR: mtr.devops.telekom.de - name: Helm Lint, Package, and Push + if: github.event.action == 'release-new-version' run: | cd deployments/chart helm lint . @@ -36,6 +37,18 @@ jobs: MTR: mtr.devops.telekom.de REPO: caas + - name: Helm Lint, Package, and Push Dev Build + if: github.event.action == 'create-dev-build' + run: | + cd deployments/chart + helm lint . + helm package . --version ${{ github.event.client_payload.version }} --app-version dev + helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts + helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts + env: + MTR: mtr.devops.telekom.de + REPO: caas + - name: Dispatch Event to Helm-Charts Repo uses: peter-evans/repository-dispatch@v3 with: From 63b65f8ebe785fb2f2b1d363dba7c1b49e693c94 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 22 Oct 2024 10:02:13 +0200 Subject: [PATCH 6/9] refactored code --- ...or-release.yaml => check_for_release.yaml} | 0 .github/workflows/check_version.yaml | 36 +++++++++---------- .github/workflows/create_dev_build.yaml | 2 +- .github/workflows/docker_build.yaml | 16 ++------- .github/workflows/helm_build.yaml | 15 +------- 5 files changed, 20 insertions(+), 49 deletions(-) rename .github/workflows/{check-for-release.yaml => check_for_release.yaml} (100%) diff --git a/.github/workflows/check-for-release.yaml b/.github/workflows/check_for_release.yaml similarity index 100% rename from .github/workflows/check-for-release.yaml rename to .github/workflows/check_for_release.yaml diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index 718f58a..b2c9f7b 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -13,6 +13,8 @@ jobs: outputs: version_change: ${{ steps.check_for_version_change.outputs.version_change }} app_version_change: ${{ steps.check_for_appVersion_change.outputs.app_version_change }} + version: ${{ steps.chart_version.outputs.version }} + appVersion: ${{ steps.app_version.outputs.app_version }} steps: - name: Checkout code @@ -32,6 +34,18 @@ jobs: version_change=$(git diff main HEAD~1 -- deployments/chart/Chart.yaml | grep -qe "^[+-]version: " && echo "version changed" || echo "version didn't change") echo "version_change=$version_change" >> $GITHUB_OUTPUT + - name: Extract Chart Version + id: chart_version + run: | + version=$(yq e '.version' ./deployments/chart/Chart.yaml) + echo "version=$version" >> $GITHUB_OUTPUT + + - name: Extract App Version + id: app_version + run: | + app_version=$(yq e '.appVersion' ./deployments/chart/Chart.yaml) + echo "app_version=$app_version" >> $GITHUB_OUTPUT + build_new_chart: runs-on: ubuntu-latest needs: check_versions @@ -40,22 +54,13 @@ jobs: contents: write steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Extract Chart Version - id: chart_version - run: | - version=$(yq e '.version' ./deployments/chart/Chart.yaml) - echo "version=$version" >> $GITHUB_ENV - - name: Dispatch Event to build new helm chart uses: peter-evans/repository-dispatch@v3 with: token: ${{ secrets.GITHUB_TOKEN }} repository: caas-team/GoKubeDownscaler event-type: build-new-chart - client-payload: '{"version": "${{ env.version }}"}' + client-payload: '{"version": "${{ needs.check_versions.outputs.version }}", "appVersion": "${{ needs.check_versions.outputs.app_version }}"}' release_new_version: runs-on: ubuntu-latest @@ -65,19 +70,10 @@ jobs: contents: write steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Extract App Version - id: app_version - run: | - app_version=$(yq e '.appVersion' ./deployments/chart/Chart.yaml) - echo "app_version=$app_version" >> $GITHUB_ENV - - name: Dispatch Event to create new release uses: peter-evans/repository-dispatch@v3 with: token: ${{ secrets.GITHUB_TOKEN }} repository: caas-team/GoKubeDownscaler event-type: release-new-version - client-payload: '{"appVersion": "${{ env.app_version }}"}' + client-payload: '{"appVersion": "${{ needs.check_versions.outputs.app_version }}", "setLatest": true}' diff --git a/.github/workflows/create_dev_build.yaml b/.github/workflows/create_dev_build.yaml index 8c6a0be..81520ee 100644 --- a/.github/workflows/create_dev_build.yaml +++ b/.github/workflows/create_dev_build.yaml @@ -25,4 +25,4 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} repository: caas-team/GoKubeDownscaler event-type: create-dev-build - client-payload: '{"version": "${{ env.version }}-dev"}' + client-payload: '{"version": "${{ env.version }}-dev","appVersion": "dev", "setLatest": false}' diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml index e249e3d..ce294b5 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/docker_build.yaml @@ -20,19 +20,9 @@ jobs: mtr.devops.telekom.de/caas/go-kube-downscaler ghcr.io/caas-team/gokubedownscaler tags: | - latest + ${{ github.event.client_payload.setLatest && 'latest' }} ${{ github.event.client_payload.appVersion }} - - name: Dev docker meta - id: dev-meta - if: github.event.action == 'create-dev-build' - uses: docker/metadata-action@v5 - with: - images: | - mtr.devops.telekom.de/caas/go-kube-downscaler - ghcr.io/caas-team/gokubedownscaler - tags: dev - - name: Install Cosign uses: sigstore/cosign-installer@main with: @@ -65,9 +55,7 @@ jobs: context: . platforms: linux/amd64 push: true - tags: | - ${{ steps.meta.outputs.tags }} - ${{ steps.dev-meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags }} - name: Sign Push run: | diff --git a/.github/workflows/helm_build.yaml b/.github/workflows/helm_build.yaml index cc480dc..8f803ff 100644 --- a/.github/workflows/helm_build.yaml +++ b/.github/workflows/helm_build.yaml @@ -26,23 +26,10 @@ jobs: MTR: mtr.devops.telekom.de - name: Helm Lint, Package, and Push - if: github.event.action == 'release-new-version' run: | cd deployments/chart helm lint . - helm package . - helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts - helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts - env: - MTR: mtr.devops.telekom.de - REPO: caas - - - name: Helm Lint, Package, and Push Dev Build - if: github.event.action == 'create-dev-build' - run: | - cd deployments/chart - helm lint . - helm package . --version ${{ github.event.client_payload.version }} --app-version dev + helm package . --version ${{ github.event.client_payload.version }} --app-version --version ${{ github.event.client_payload.appVersion }} helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts env: From 518f1c92bc9691d8710eede7cefc9dda7811372c Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 22 Oct 2024 10:10:29 +0200 Subject: [PATCH 7/9] fix: typo --- .github/workflows/check_version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index b2c9f7b..486fbfc 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -14,7 +14,7 @@ jobs: version_change: ${{ steps.check_for_version_change.outputs.version_change }} app_version_change: ${{ steps.check_for_appVersion_change.outputs.app_version_change }} version: ${{ steps.chart_version.outputs.version }} - appVersion: ${{ steps.app_version.outputs.app_version }} + app_version: ${{ steps.app_version.outputs.app_version }} steps: - name: Checkout code From 55186b2febb0155a82125fb0109ebef81acd3322 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 22 Oct 2024 10:35:50 +0200 Subject: [PATCH 8/9] fix errors --- .github/workflows/docker_build.yaml | 1 - .github/workflows/helm_build.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml index ce294b5..eac3972 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/docker_build.yaml @@ -13,7 +13,6 @@ jobs: - name: Docker meta id: meta - if: github.event.action == 'release-new-version' uses: docker/metadata-action@v5 with: images: | diff --git a/.github/workflows/helm_build.yaml b/.github/workflows/helm_build.yaml index 8f803ff..b1dc5d1 100644 --- a/.github/workflows/helm_build.yaml +++ b/.github/workflows/helm_build.yaml @@ -29,7 +29,7 @@ jobs: run: | cd deployments/chart helm lint . - helm package . --version ${{ github.event.client_payload.version }} --app-version --version ${{ github.event.client_payload.appVersion }} + helm package . --version ${{ github.event.client_payload.version }} --app-version ${{ github.event.client_payload.appVersion }} helm push $(ls *.tgz | head -1) oci://ghcr.io/caas-team/charts helm push $(ls *.tgz | head -1) oci://${MTR}/${REPO}/charts env: From 6e786f37cbcb188137bc098bdbc524759681bd8f Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 22 Oct 2024 11:07:41 +0200 Subject: [PATCH 9/9] add option for latest tag to be empty --- .github/workflows/docker_build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/docker_build.yaml index eac3972..cd478e1 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/docker_build.yaml @@ -19,7 +19,7 @@ jobs: mtr.devops.telekom.de/caas/go-kube-downscaler ghcr.io/caas-team/gokubedownscaler tags: | - ${{ github.event.client_payload.setLatest && 'latest' }} + ${{ github.event.client_payload.setLatest && 'latest' || '' }} ${{ github.event.client_payload.appVersion }} - name: Install Cosign