From ab1496673e71ccd97ecf50a5d5119c5b2abc2926 Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Tue, 14 Nov 2023 14:30:18 +1100 Subject: [PATCH] add minio settings to dwp and make into a helm test job --- charts/lagoon-test/Chart.yaml | 2 +- charts/lagoon-test/templates/_helpers.tpl | 6 ++-- ...=> local-api-data-watcher-pusher.job.yaml} | 32 ++++++------------- .../templates/tests/test-connection.yaml | 3 +- .../templates/tests/test-suite.yaml | 3 +- 5 files changed, 18 insertions(+), 28 deletions(-) rename charts/lagoon-test/templates/{local-api-data-watcher-pusher.deployment.yaml => local-api-data-watcher-pusher.job.yaml} (80%) diff --git a/charts/lagoon-test/Chart.yaml b/charts/lagoon-test/Chart.yaml index cc055519..6a1cedbc 100644 --- a/charts/lagoon-test/Chart.yaml +++ b/charts/lagoon-test/Chart.yaml @@ -29,4 +29,4 @@ appVersion: v2.16.0 annotations: artifacthub.io/changes: | - kind: changed - description: add minio settings to api-data-watcher-pusher + description: add minio settings to api-data-watcher-pusher and make into a helm test job diff --git a/charts/lagoon-test/templates/_helpers.tpl b/charts/lagoon-test/templates/_helpers.tpl index 3fe70843..e7810695 100644 --- a/charts/lagoon-test/templates/_helpers.tpl +++ b/charts/lagoon-test/templates/_helpers.tpl @@ -92,14 +92,14 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{/* -Create a default fully qualified app name for local-git. +Create a default fully qualified app name for local-api-data-watcher-pusher. */}} {{- define "lagoon-test.localAPIDataWatcherPusher.fullname" -}} {{- include "lagoon-test.fullname" . }}-local-api-data-watcher-pusher {{- end }} {{/* -Common labels local-git. +Common labels local-api-data-watcher-pusher. */}} {{- define "lagoon-test.localAPIDataWatcherPusher.labels" -}} helm.sh/chart: {{ include "lagoon-test.chart" . }} @@ -111,7 +111,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{/* -Selector labels local-git. +Selector labels local-api-data-watcher-pusher. */}} {{- define "lagoon-test.localAPIDataWatcherPusher.selectorLabels" -}} app.kubernetes.io/name: {{ include "lagoon-test.name" . }} diff --git a/charts/lagoon-test/templates/local-api-data-watcher-pusher.deployment.yaml b/charts/lagoon-test/templates/local-api-data-watcher-pusher.job.yaml similarity index 80% rename from charts/lagoon-test/templates/local-api-data-watcher-pusher.deployment.yaml rename to charts/lagoon-test/templates/local-api-data-watcher-pusher.job.yaml index bede06d4..2efae436 100644 --- a/charts/lagoon-test/templates/local-api-data-watcher-pusher.deployment.yaml +++ b/charts/lagoon-test/templates/local-api-data-watcher-pusher.job.yaml @@ -1,34 +1,29 @@ -apiVersion: apps/v1 -kind: Deployment +apiVersion: batch/v1 +kind: Job metadata: name: {{ include "lagoon-test.localAPIDataWatcherPusher.fullname" . }} labels: {{- include "lagoon-test.localAPIDataWatcherPusher.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test + "helm.sh/hook-weight": "10" spec: - selector: - matchLabels: - {{- include "lagoon-test.localAPIDataWatcherPusher.selectorLabels" . | nindent 6 }} + backoffLimit: 2 template: metadata: - {{- with .Values.localAPIDataWatcherPusher.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} labels: {{- include "lagoon-test.localAPIDataWatcherPusher.selectorLabels" . | nindent 8 }} spec: - {{- with .Values.localAPIDataWatcherPusher.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} + restartPolicy: Never securityContext: {{- toYaml .Values.localAPIDataWatcherPusher.podSecurityContext | nindent 8 }} + terminationGracePeriodSeconds: 120 containers: - name: api-data-watcher-pusher - securityContext: - {{- toYaml .Values.localAPIDataWatcherPusher.securityContext | nindent 10 }} image: "{{ .Values.localAPIDataWatcherPusher.image.repository }}:{{ coalesce .Values.localAPIDataWatcherPusher.image.tag .Values.imageTag .Chart.AppVersion }}" imagePullPolicy: {{ .Values.localAPIDataWatcherPusher.image.pullPolicy }} + securityContext: + {{- toYaml .Values.localAPIDataWatcherPusher.securityContext | nindent 10 }} env: - name: API_HOST value: {{ .Values.apiHost | quote }} @@ -55,13 +50,6 @@ spec: value: {{ .Values.minioPass | quote }} - name: TOKEN value: {{ required "A valid .Values.token required!" .Values.token | quote }} - startupProbe: - exec: - command: - - test - - -f - - /tmp/api-data-pushed - failureThreshold: 90 resources: {{- toYaml .Values.localAPIDataWatcherPusher.resources | nindent 10 }} {{- with .Values.localAPIDataWatcherPusher.nodeSelector }} diff --git a/charts/lagoon-test/templates/tests/test-connection.yaml b/charts/lagoon-test/templates/tests/test-connection.yaml index cba025e5..ddaa44b1 100644 --- a/charts/lagoon-test/templates/tests/test-connection.yaml +++ b/charts/lagoon-test/templates/tests/test-connection.yaml @@ -5,7 +5,8 @@ metadata: labels: {{- include "lagoon-test.labels" . | nindent 4 }} annotations: - "helm.sh/hook": test-success + "helm.sh/hook": test + "helm.sh/hook-weight": "30" spec: containers: - name: nc diff --git a/charts/lagoon-test/templates/tests/test-suite.yaml b/charts/lagoon-test/templates/tests/test-suite.yaml index e83d858b..546051bc 100644 --- a/charts/lagoon-test/templates/tests/test-suite.yaml +++ b/charts/lagoon-test/templates/tests/test-suite.yaml @@ -6,7 +6,8 @@ metadata: labels: {{- include "lagoon-test.labels" . | nindent 4 }} annotations: - "helm.sh/hook": test-success + "helm.sh/hook": test + "helm.sh/hook-weight": "50" spec: serviceAccountName: {{ include "lagoon-test.serviceAccountName" . }} containers: