From 39b1d569a8111b773febdb50e34bc9d6ca678779 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 19 Jun 2024 12:50:14 +1000 Subject: [PATCH] chore: install and test feature-flag updater --- .github/workflows/lint-test.yaml | 5 ++ charts/lagoon-core/Chart.yaml | 8 +-- .../ci/testlagoon-main-override.yaml | 1 + charts/lagoon-core/templates/_helpers.tpl | 9 +++ .../templates/broker.flag-enable.job.yaml | 63 +++++++++++++++++++ 5 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 charts/lagoon-core/templates/broker.flag-enable.job.yaml diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 6db580e99..9e9e3b076 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -96,6 +96,11 @@ jobs: ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m" if: ${{ contains(github.event.pull_request.labels.*.name, 'next-release') }} + - name: Run chart-testing (upgrade changed next-release only) + run: | + ct install --upgrade --config ./default.ct.yaml --helm-extra-args "--timeout 30m" + if: ${{ contains(github.event.pull_request.labels.*.name, 'next-release') }} + - name: Run chart-testing (install all charts when required) run: ct install --config ./default.ct.yaml --helm-extra-args "--timeout 30m" --all if: ${{ contains(github.event.pull_request.labels.*.name, 'next-release') || contains(github.event.pull_request.labels.*.name, 'needs-testing') }} diff --git a/charts/lagoon-core/Chart.yaml b/charts/lagoon-core/Chart.yaml index 48d23d8cd..afa8e819e 100644 --- a/charts/lagoon-core/Chart.yaml +++ b/charts/lagoon-core/Chart.yaml @@ -21,7 +21,7 @@ type: application # time you make changes to the chart and its templates, including the app # version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.46.0 +version: 1.47.0 # This is the version number of the application being deployed. This version # number should be incremented each time you make changes to the application. @@ -41,8 +41,4 @@ dependencies: annotations: artifacthub.io/changes: | - kind: changed - description: prepare for Lagoon v2.20.0 release - - kind: changed - description: update values for local development - - kind: changed - description: bump minimum Kubernetes version to 1.25 + description: added broker-flag-enable pre-update job diff --git a/charts/lagoon-core/ci/testlagoon-main-override.yaml b/charts/lagoon-core/ci/testlagoon-main-override.yaml index 88b92cab4..ca08cca8c 100644 --- a/charts/lagoon-core/ci/testlagoon-main-override.yaml +++ b/charts/lagoon-core/ci/testlagoon-main-override.yaml @@ -27,6 +27,7 @@ keycloakDB: broker: image: repository: testlagoon/broker + tag: pr-3670 authServer: image: diff --git a/charts/lagoon-core/templates/_helpers.tpl b/charts/lagoon-core/templates/_helpers.tpl index 5c5b09513..ec90ca698 100644 --- a/charts/lagoon-core/templates/_helpers.tpl +++ b/charts/lagoon-core/templates/_helpers.tpl @@ -240,6 +240,15 @@ app.kubernetes.io/instance: {{ .Release.Name }} +{{/* +Create a default fully qualified app name for broker-flag-enable job. +*/}} +{{- define "lagoon-core.brokerFlagEnable.fullname" -}} +{{- include "lagoon-core.fullname" . }}-broker-flag-enable +{{- end }} + + + {{/* Create a default fully qualified app name for auth-server. */}} diff --git a/charts/lagoon-core/templates/broker.flag-enable.job.yaml b/charts/lagoon-core/templates/broker.flag-enable.job.yaml new file mode 100644 index 000000000..0ffa1c296 --- /dev/null +++ b/charts/lagoon-core/templates/broker.flag-enable.job.yaml @@ -0,0 +1,63 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "lagoon-core.brokerFlagEnable.fullname" . }} + labels: + {{- include "lagoon-core.broker.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": pre-upgrade + "helm.sh/hook-weight": "-5" +spec: + backoffLimit: 2 + template: + metadata: + labels: + {{- include "lagoon-core.broker.selectorLabels" . | nindent 8 }} + spec: + restartPolicy: Never + securityContext: + {{- toYaml .Values.broker.securityContext | nindent 8 }} + terminationGracePeriodSeconds: 120 + containers: + - name: broker-flag-enable + args: + - /enable-feature-flags.sh + image: testlagoon/broker:pr-3670 + imagePullPolicy: {{ .Values.broker.image.pullPolicy }} + command: + - /bin/sh + - -c + securityContext: + {{- toYaml .Values.broker.securityContext | nindent 10 }} + env: + - name: RABBITMQ_DEFAULT_PASS + valueFrom: + secretKeyRef: + name: {{ include "lagoon-core.broker.fullname" . }} + key: RABBITMQ_PASSWORD + - name: RABBITMQ_DEFAULT_USER + valueFrom: + secretKeyRef: + name: {{ include "lagoon-core.broker.fullname" . }} + key: RABBITMQ_USERNAME + - name: RABBITMQ_USE_LONGNAME + value: "true" + # these variables are used by the /cluster-rabbit.sh entrypoint + - name: POD_NAMESPACE + value: {{ .Release.Namespace | quote }} + - name: SERVICE_NAME + value: {{ include "lagoon-core.broker.fullname" . }} + {{- range $key, $val := .Values.broker.additionalEnvs }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} + resources: + {{- toYaml .Values.broker.resources | nindent 10 }} + {{- with .Values.broker.nodeSelector }} + nodeSelector: + {{ toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.broker.tolerations }} + tolerations: + {{ toYaml . | nindent 8 }} + {{- end }}