From 8d8eadb47fce65c43d1d96730507adf939b73fe4 Mon Sep 17 00:00:00 2001 From: Tigran Muradyan Date: Fri, 14 Jun 2024 19:14:03 +0400 Subject: [PATCH] fix(DMVP-3604): have chart fixes related volumes --- .github/workflows/release.yaml | 39 +++++++++++++++------- charts/base-cronjob/templates/cronjob.yaml | 9 +++++ charts/base/templates/deployment.yaml | 3 ++ charts/base/templates/service.yaml | 3 ++ 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 13b1f55..0a5e041 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,21 +3,36 @@ name: Release helm chart on: push: branches: - - main + - DMVP-3604-helm-charts-improvements jobs: - release: + semantic-release: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 with: - fetch-depth: 0 - - name: Configure Git + filters: | + charts_changed: + - 'charts/*' + + # run only if some 'charts' files were changed + - name: backend tests + if: steps.filter.outputs.backend == 'true' run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Run Release - uses: helm/chart-releaser-action@v1.0.0 - env: - CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + echo "charts changed: ${{ steps.filter.outputs.charts_changed_files }}" + # release: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Configure Git + # run: | + # git config user.name "$GITHUB_ACTOR" + # git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + # - name: Run Release + # uses: helm/chart-releaser-action@v1.6.0 + # env: + # CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}' diff --git a/charts/base-cronjob/templates/cronjob.yaml b/charts/base-cronjob/templates/cronjob.yaml index df616da..f9a7a94 100644 --- a/charts/base-cronjob/templates/cronjob.yaml +++ b/charts/base-cronjob/templates/cronjob.yaml @@ -32,6 +32,10 @@ spec: configmap: "{{ $job.config | toYaml | sha256sum | trunc 8 }}" spec: serviceAccountName: {{ $job.serviceAccount.name }} + {{- with $job.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 12 }} + {{- end }} restartPolicy: {{ $job.restartPolicy }} containers: - name: {{ $job.name | quote }} @@ -66,6 +70,9 @@ spec: envFrom: - configMapRef: name: {{ $job.name | quote}} + {{- with $job.envFrom }} + {{- toYaml . | nindent 16 }} + {{- end }} volumeMounts: {{- range $index, $element := $job.volumes }} - name: {{ coalesce $element.name (add $index 1) }} @@ -94,11 +101,13 @@ spec: claimName: {{ $element.persistentVolumeClaim.claimName }} {{- end }} {{- end }} + {{- if $element.configMap }} configMap: name: {{ $element.configMap.name | default $job.name}} {{- if $element.configMap.defaultMode }} defaultMode: {{ $element.configMap.defaultMode }} {{- end }} + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/base/templates/deployment.yaml b/charts/base/templates/deployment.yaml index d99139b..f66c3f1 100644 --- a/charts/base/templates/deployment.yaml +++ b/charts/base/templates/deployment.yaml @@ -171,6 +171,9 @@ spec: {{- if eq $element.container "extra"}} - name: {{ coalesce $element.name (add $index 1) }} mountPath: {{ $element.mountPath }} + {{- if $element.subPath }} + subPath: {{ $element.subPath }} + {{- end }} readOnly: {{ $element.readOnly | default false }} {{- end }} {{- end }} diff --git a/charts/base/templates/service.yaml b/charts/base/templates/service.yaml index a96ffaa..80311f7 100644 --- a/charts/base/templates/service.yaml +++ b/charts/base/templates/service.yaml @@ -16,6 +16,9 @@ spec: targetPort: {{ .Values.service.targetPort | default .Values.containerPort }} protocol: {{ .Values.service.protocol }} name: {{ .Values.service.name }} + {{- if .Values.service.extraPorts }} + {{- toYaml .Values.service.extraPorts | nindent 4 }} + {{- end }} selector: {{- include "base.selectorLabels" . | nindent 4 }} {{- end }}