Skip to content

Commit

Permalink
properly generate service account name
Browse files Browse the repository at this point in the history
  • Loading branch information
mazay committed Nov 3, 2024
1 parent fec0a83 commit d2255b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/helm-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions charts/s3sync-service/ci/custom-sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
serviceAccountName: foobar
8 changes: 7 additions & 1 deletion charts/s3sync-service/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/s3sync-service/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit d2255b0

Please sign in to comment.