diff --git a/README.md b/README.md index 75d0da83..c81804f6 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ helm delete --namespace test my-application | Key | Type | Default | Description | |-----|------|---------|-------------| | rbac.enabled | bool | `true` | Enable RBAC. | -| rbac.serviceAccount.enabled | bool | `false` | Deploy Service Account. | +| rbac.serviceAccount.enabled | bool | `true` | Deploy a Service Account. | | rbac.serviceAccount.name | string | `{{ include "application.name" $ }}` | Service Account Name. | | rbac.serviceAccount.additionalLabels | object | `nil` | Additional labels for Service Account. | | rbac.serviceAccount.annotations | object | `nil` | Annotations for Service Account. | diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index 3db0c94c..6e84378b 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -54,12 +54,8 @@ spec: annotations: {{ toYaml . | nindent 12 }} {{- end }} spec: - {{- if $.Values.rbac.enabled }} - {{- if $.Values.rbac.serviceAccount.name }} - serviceAccountName: {{ $.Values.rbac.serviceAccount.name }} - {{- else }} - serviceAccountName: {{ template "application.name" $ }} - {{- end }} + {{- if and $.Values.rbac.enabled $.Values.rbac.serviceAccount.enabled }} + serviceAccountName: {{ default (include "application.name" $) $.Values.rbac.serviceAccount.name }} {{- end }} containers: - name: {{ $name }} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 4f5bfd23..3a536a1e 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -308,12 +308,8 @@ spec: {{- end }} {{- end }} {{- end }} - {{- if .Values.rbac.serviceAccount.enabled }} - {{- if .Values.rbac.serviceAccount.name }} - serviceAccountName: {{ .Values.rbac.serviceAccount.name }} - {{- else }} - serviceAccountName: {{ template "application.name" $ }} - {{- end }} + {{- if and .Values.rbac.enabled .Values.rbac.serviceAccount.enabled }} + serviceAccountName: {{ default (include "application.name" .) .Values.rbac.serviceAccount.name }} {{- end }} {{- if .Values.deployment.hostNetwork }} hostNetwork: {{ .Values.deployment.hostNetwork }} diff --git a/application/templates/job.yaml b/application/templates/job.yaml index 8097a15d..757f4433 100644 --- a/application/templates/job.yaml +++ b/application/templates/job.yaml @@ -37,12 +37,8 @@ spec: annotations: {{ toYaml . | nindent 8 }} {{- end }} spec: - {{- if $.Values.rbac.enabled }} - {{- if $.Values.rbac.serviceAccount.name }} - serviceAccountName: {{ $.Values.rbac.serviceAccount.name }} - {{- else }} - serviceAccountName: {{ template "application.name" $ }} - {{- end }} + {{- if and $.Values.rbac.enabled $.Values.rbac.serviceAccount.enabled }} + serviceAccountName: {{ default (include "application.name" $) $.Values.rbac.serviceAccount.name }} {{- end }} containers: - name: {{ $name }} diff --git a/application/values.yaml b/application/values.yaml index 3569adb6..c536ddd6 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -655,9 +655,9 @@ rbac: # @section -- RBAC Parameters enabled: true serviceAccount: - # -- (bool) Deploy Service Account. + # -- (bool) Deploy a Service Account. # @section -- RBAC Parameters - enabled: false + enabled: true # -- (string) Service Account Name. # @default -- `{{ include "application.name" $ }}` # @section -- RBAC Parameters