diff --git a/.github/workflows/helm-lint.yml b/.github/workflows/helm-lint.yml index f002841..30b4725 100644 --- a/.github/workflows/helm-lint.yml +++ b/.github/workflows/helm-lint.yml @@ -30,7 +30,13 @@ jobs: uses: helm/chart-testing-action@v2 - name: Helm template - run: helm template charts/s3sync-service + run: | + shopt -s globstar + for v in charts/s3sync-service/ci/**/*.y*ml; do + echo "::group::Template for ${v}" + helm template charts/s3sync-service -f "${v}" + echo "::endgroup::" + done - name: Run chart-testing (list-changed) id: list-changed diff --git a/charts/s3sync-service/ci/custom-sa.yaml b/charts/s3sync-service/ci/custom-sa.yaml new file mode 100644 index 0000000..4e5b759 --- /dev/null +++ b/charts/s3sync-service/ci/custom-sa.yaml @@ -0,0 +1 @@ +serviceAccountName: foobar diff --git a/charts/s3sync-service/templates/_helpers.tpl b/charts/s3sync-service/templates/_helpers.tpl index 81814a2..8cc6c17 100644 --- a/charts/s3sync-service/templates/_helpers.tpl +++ b/charts/s3sync-service/templates/_helpers.tpl @@ -7,7 +7,13 @@ {{- end -}} {{- define "s3sync.serviceAccountName" -}} -{{- .Values.serviceAccountName | default (include "s3sync.fullname" .) -}} +{{- if .Values.serviceAccountName -}} +{{- .Values.serviceAccountName -}} +{{- else if .Values.createRbac -}} +{{- include "s3sync.fullname" . -}} +{{- else -}} +default +{{- end -}} {{- end -}} {{- define "s3sync.labels" -}} diff --git a/charts/s3sync-service/templates/rbac.yaml b/charts/s3sync-service/templates/rbac.yaml index 8511df9..d0b5281 100644 --- a/charts/s3sync-service/templates/rbac.yaml +++ b/charts/s3sync-service/templates/rbac.yaml @@ -36,7 +36,7 @@ subjects: apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "s3sync.fullname" . }} + name: {{ include "s3sync.serviceAccountName" . }} labels: {{- include "s3sync.labels" . | nindent 4 }} {{- end }}