From e789f11b8f4a8943e98ffa076f21286dacf3517e Mon Sep 17 00:00:00 2001 From: Alex Vincent Date: Sat, 25 May 2024 08:20:55 +0200 Subject: [PATCH] F2calv/2024 04 improve helm chart (#88) * handle empty envVars * add more hasKey * added maintainers * remove maintainers * tweak ci --- .github/workflows/ci.yml | 1 + .../templates/deployment.yaml | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87e6721..396e50c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,7 @@ jobs: chart-repository-prefix: charts/ tag: ${{ needs.versioning.outputs.semVer }} push-chart: ${{ github.ref_name == github.event.repository.default_branch }} + chart-testing-cli-command: install release: needs: [versioning, app, image, chart] diff --git a/charts/multi-arch-container-rust/templates/deployment.yaml b/charts/multi-arch-container-rust/templates/deployment.yaml index 3300083..282432f 100644 --- a/charts/multi-arch-container-rust/templates/deployment.yaml +++ b/charts/multi-arch-container-rust/templates/deployment.yaml @@ -28,12 +28,16 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "multi-arch-container-rust.serviceAccountName" . }} + {{- if hasKey .Values "podSecurityContext" }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} + {{- if hasKey .Values "securityContext" }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} + {{- end }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: @@ -41,26 +45,36 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP env: + {{- if hasKey .Values "git" }} - name: "GIT_REPOSITORY" value: {{ .Values.git.repository | default "" | quote }} - name: "GIT_BRANCH" value: {{ .Values.git.branch | default "" | quote }} - name: "GIT_COMMIT" value: {{ .Values.git.commit | default "" | quote }} + {{- end }} - name: "GIT_TAG" value: {{ .Values.image.tag | default .Chart.AppVersion }} + {{- if hasKey .Values "github" }} - name: "GITHUB_WORKFLOW" value: {{ .Values.github.workflow | default "" | quote }} - name: "GITHUB_RUN_ID" value: {{ .Values.github.run_id | int64 | default 0 | quote }} - name: "GITHUB_RUN_NUMBER" value: {{ .Values.github.run_number | int64 | default 0 | quote }} + {{- end }} + {{- if hasKey .Values "livenessProbe" }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} + {{- end }} + {{- if hasKey .Values "readinessProbe" }} readinessProbe: {{- toYaml .Values.readinessProbe | nindent 12 }} + {{- end }} + {{- if hasKey .Values "resources" }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} {{- with .Values.volumeMounts }} volumeMounts: {{- toYaml . | nindent 12 }}