Chart: Set automountServiceAccountToken
in workloads. (#12247)
Signed-off-by: Aran Shavit <Aranshavit@gmail.com> Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
This commit is contained in:
parent
bd76cf8f05
commit
e07f0f6890
10 changed files with 55 additions and 0 deletions
|
@ -67,6 +67,7 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
serviceAccountName: {{ include "ingress-nginx.admissionWebhooks.patch.serviceAccountName" . }}
|
serviceAccountName: {{ include "ingress-nginx.admissionWebhooks.patch.serviceAccountName" . }}
|
||||||
|
automountServiceAccountToken: {{ .Values.controller.admissionWebhooks.patch.serviceAccount.automountServiceAccountToken }}
|
||||||
{{- if .Values.controller.admissionWebhooks.patch.nodeSelector }}
|
{{- if .Values.controller.admissionWebhooks.patch.nodeSelector }}
|
||||||
nodeSelector: {{ toYaml .Values.controller.admissionWebhooks.patch.nodeSelector | nindent 8 }}
|
nodeSelector: {{ toYaml .Values.controller.admissionWebhooks.patch.nodeSelector | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -69,6 +69,7 @@ spec:
|
||||||
{{- end }}
|
{{- end }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
serviceAccountName: {{ include "ingress-nginx.admissionWebhooks.patch.serviceAccountName" . }}
|
serviceAccountName: {{ include "ingress-nginx.admissionWebhooks.patch.serviceAccountName" . }}
|
||||||
|
automountServiceAccountToken: {{ .Values.controller.admissionWebhooks.patch.serviceAccount.automountServiceAccountToken }}
|
||||||
{{- if .Values.controller.admissionWebhooks.patch.nodeSelector }}
|
{{- if .Values.controller.admissionWebhooks.patch.nodeSelector }}
|
||||||
nodeSelector: {{ toYaml .Values.controller.admissionWebhooks.patch.nodeSelector | nindent 8 }}
|
nodeSelector: {{ toYaml .Values.controller.admissionWebhooks.patch.nodeSelector | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -202,6 +202,7 @@ spec:
|
||||||
topologySpreadConstraints: {{ tpl (toYaml .Values.controller.topologySpreadConstraints) $ | nindent 8 }}
|
topologySpreadConstraints: {{ tpl (toYaml .Values.controller.topologySpreadConstraints) $ | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
serviceAccountName: {{ template "ingress-nginx.serviceAccountName" . }}
|
serviceAccountName: {{ template "ingress-nginx.serviceAccountName" . }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
|
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
|
||||||
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraVolumes .Values.controller.extraModules) }}
|
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraVolumes .Values.controller.extraModules) }}
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -208,6 +208,7 @@ spec:
|
||||||
topologySpreadConstraints: {{ tpl (toYaml .Values.controller.topologySpreadConstraints) $ | nindent 8 }}
|
topologySpreadConstraints: {{ tpl (toYaml .Values.controller.topologySpreadConstraints) $ | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
serviceAccountName: {{ template "ingress-nginx.serviceAccountName" . }}
|
serviceAccountName: {{ template "ingress-nginx.serviceAccountName" . }}
|
||||||
|
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
||||||
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
|
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
|
||||||
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraVolumes .Values.controller.extraModules) }}
|
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraVolumes .Values.controller.extraModules) }}
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -103,6 +103,7 @@ spec:
|
||||||
nodeSelector: {{ toYaml .Values.defaultBackend.nodeSelector | nindent 8 }}
|
nodeSelector: {{ toYaml .Values.defaultBackend.nodeSelector | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
serviceAccountName: {{ include "ingress-nginx.defaultBackend.serviceAccountName" . }}
|
serviceAccountName: {{ include "ingress-nginx.defaultBackend.serviceAccountName" . }}
|
||||||
|
automountServiceAccountToken: {{ .Values.defaultBackend.serviceAccount.automountServiceAccountToken }}
|
||||||
{{- if .Values.defaultBackend.tolerations }}
|
{{- if .Values.defaultBackend.tolerations }}
|
||||||
tolerations: {{ toYaml .Values.defaultBackend.tolerations | nindent 8 }}
|
tolerations: {{ toYaml .Values.defaultBackend.tolerations | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
suite: Admission Webhooks > Patch Job > Create Secret Job
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/job-patch/job-createSecret.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should create a Job with token auto-mounting disabled if `controller.admissionWebhooks.patch.serviceAccount.automountServiceAccountToken` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.patch.serviceAccount.automountServiceAccountToken: false
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.automountServiceAccountToken
|
||||||
|
value: false
|
|
@ -0,0 +1,12 @@
|
||||||
|
suite: Admission Webhooks > Patch Job > Patch Webhook Job
|
||||||
|
templates:
|
||||||
|
- admission-webhooks/job-patch/job-patchWebhook.yaml
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- it: should create a Job with token auto-mounting disabled if `controller.admissionWebhooks.patch.serviceAccount.automountServiceAccountToken` is false
|
||||||
|
set:
|
||||||
|
controller.admissionWebhooks.patch.serviceAccount.automountServiceAccountToken: false
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.automountServiceAccountToken
|
||||||
|
value: false
|
|
@ -190,3 +190,12 @@ tests:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: registry.k8s.io/ingress-nginx/controller:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
|
value: registry.k8s.io/ingress-nginx/controller:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
|
||||||
|
|
||||||
|
- it: should create a DaemonSet with token auto-mounting disabled if `serviceAccount.automountServiceAccountToken` is false
|
||||||
|
set:
|
||||||
|
controller.kind: DaemonSet
|
||||||
|
serviceAccount.automountServiceAccountToken: false
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.automountServiceAccountToken
|
||||||
|
value: false
|
||||||
|
|
|
@ -215,3 +215,11 @@ tests:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.progressDeadlineSeconds
|
path: spec.progressDeadlineSeconds
|
||||||
value: 111
|
value: 111
|
||||||
|
|
||||||
|
- it: should create a Deployment with token auto-mounting disabled if `serviceAccount.automountServiceAccountToken` is false
|
||||||
|
set:
|
||||||
|
serviceAccount.automountServiceAccountToken: false
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.automountServiceAccountToken
|
||||||
|
value: false
|
||||||
|
|
|
@ -187,3 +187,12 @@ tests:
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.containers[0].image
|
path: spec.template.spec.containers[0].image
|
||||||
value: registry.k8s.io/defaultbackend-amd64:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
|
value: registry.k8s.io/defaultbackend-amd64:custom-tag@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
|
||||||
|
|
||||||
|
- it: should create a Deployment with token auto-mounting disabled if `defaultBackend.serviceAccount.automountServiceAccountToken` is false
|
||||||
|
set:
|
||||||
|
defaultBackend.enabled: true
|
||||||
|
defaultBackend.serviceAccount.automountServiceAccountToken: false
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.automountServiceAccountToken
|
||||||
|
value: false
|
||||||
|
|
Loading…
Reference in a new issue