-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
csi/server.statefulset: custom security context #767
Changes from 1 commit
86d4b22
ca70177
135335f
3e45aa5
ee047f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,11 @@ CHANGES: | |
* Deprecated `injector.externalVaultAddr`. Added `global.externalVaultAddr`, which applies to both the Injector and the CSI Provider. [GH-745](https://github.com/hashicorp/vault-helm/pull/745) | ||
* CSI Provider pods now set the `VAULT_ADDR` environment variable to either the internal Vault service or the configured external address. [GH-745](https://github.com/hashicorp/vault-helm/pull/745) | ||
* Deprecated `injector.uid` and `injector.gid`. Replaced with `injector.securityContext.pod`. [GH-750](https://github.com/hashicorp/vault-helm/pull/750) | ||
* injector: Allow setting securityContext for pod and container to be objects or YAML strings. [GH-767](https://github.com/hashicorp/vault-helm/pull/767) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably move this down/combine it with the entry on line 14 (just mention both PRs in the entry) since GH-750 hasn't been released yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
Features: | ||
* server: Add `server.statefulSet.securityContext` to override pod and container `securityContext`. [GH-767](https://github.com/hashicorp/vault-helm/pull/767) | ||
* csi: Add `csi.daemonSet.securityContext` to override pod and container `securityContext`. [GH-767](https://github.com/hashicorp/vault-helm/pull/767) | ||
* Add `server.service.activeNodePort` and `server.service.standbyNodePort` to specify the `nodePort` for active and standby services. [GH-610](https://github.com/hashicorp/vault-helm/pull/610) | ||
* Support for setting annotations on the injector's serviceAccount [GH-753](https://github.com/hashicorp/vault-helm/pull/753) | ||
* injector: Support setting both pod and container securityContext [GH-750](https://github.com/hashicorp/vault-helm/pull/750) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -474,14 +474,20 @@ Sets extra injector service annotations | |||||
securityContext for the injector pod level. | ||||||
*/}} | ||||||
{{- define "injector.securityContext.pod" -}} | ||||||
{{- if or (.Values.injector.uid) (.Values.injector.gid) }} | ||||||
{{- if .Values.injector.securityContext.pod }} | ||||||
securityContext: | ||||||
{{- $tp := typeOf .Values.injector.securityContext.pod }} | ||||||
{{- if eq $tp "string" }} | ||||||
{{- tpl .Values.injector.securityContext.pod . | nindent 8 }} | ||||||
{{- else }} | ||||||
{{- toYaml .Values.injector.securityContext.pod | nindent 8 }} | ||||||
{{- end }} | ||||||
{{- else }} | ||||||
securityContext: | ||||||
runAsNonRoot: true | ||||||
runAsGroup: {{ .Values.injector.gid | default 1000 }} | ||||||
runAsUser: {{ .Values.injector.uid | default 100 }} | ||||||
{{- else if .Values.injector.securityContext.pod }} | ||||||
securityContext: | ||||||
{{- toYaml .Values.injector.securityContext.pod | nindent 8 }} | ||||||
fsGroup: {{ .Values.injector.gid | default 1000 }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move the openshift check into the helper's else clause similar to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
{{- end }} | ||||||
{{- end -}} | ||||||
|
||||||
|
@@ -491,9 +497,54 @@ securityContext for the injector container level. | |||||
{{- define "injector.securityContext.container" -}} | ||||||
{{- if .Values.injector.securityContext.container}} | ||||||
securityContext: | ||||||
{{- toYaml .Values.injector.securityContext.container | nindent 12 }} | ||||||
{{- $tp := typeOf .Values.injector.securityContext.container }} | ||||||
{{- if eq $tp "string" }} | ||||||
{{- tpl .Values.injector.securityContext.container . | nindent 12 }} | ||||||
Comment on lines
+501
to
+502
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be good to add another test that sets this as a multi-line string. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
{{- else }} | ||||||
{{- toYaml .Values.injector.securityContext.container | nindent 12 }} | ||||||
{{- end }} | ||||||
{{- end }} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move the openshift check into the helper here to match server and csi? i.e.
Suggested change
And remove the check from injector-deployment.yaml. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, but wouldn't the else here be empty? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, nevermind -- I see, we should move the default out of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||
{{- end -}} | ||||||
{{- end -}} | ||||||
|
||||||
{{/* | ||||||
securityContext for the statefulset pod template. | ||||||
*/}} | ||||||
{{- define "server.statefulSet.securityContext.pod" -}} | ||||||
{{- if .Values.server.statefulSet.securityContext.pod }} | ||||||
securityContext: | ||||||
{{- $tp := typeOf .Values.server.statefulSet.securityContext.pod }} | ||||||
{{- if eq $tp "string" }} | ||||||
{{- tpl .Values.server.statefulSet.securityContext.pod . | nindent 8 }} | ||||||
{{- else }} | ||||||
{{- toYaml .Values.server.statefulSet.securityContext.pod | nindent 8 }} | ||||||
{{- end }} | ||||||
{{- else if not .Values.global.openshift }} | ||||||
securityContext: | ||||||
runAsNonRoot: true | ||||||
runAsGroup: {{ .Values.server.gid | default 1000 }} | ||||||
runAsUser: {{ .Values.server.uid | default 100 }} | ||||||
fsGroup: {{ .Values.server.gid | default 1000 }} | ||||||
{{- end }} | ||||||
{{- end -}} | ||||||
|
||||||
{{/* | ||||||
securityContext for the statefulset vault container | ||||||
*/}} | ||||||
{{- define "server.statefulSet.securityContext.container" -}} | ||||||
{{- if .Values.server.statefulSet.securityContext.container }} | ||||||
securityContext: | ||||||
{{- $tp := typeOf .Values.server.statefulSet.securityContext.container }} | ||||||
{{- if eq $tp "string" }} | ||||||
{{- tpl .Values.server.statefulSet.securityContext.container . | nindent 12 }} | ||||||
{{- else }} | ||||||
{{- toYaml .Values.server.statefulSet.securityContext.container | nindent 12 }} | ||||||
{{- end }} | ||||||
{{- else if not .Values.global.openshift }} | ||||||
securityContext: | ||||||
allowPrivilegeEscalation: false | ||||||
{{- end }} | ||||||
{{- end -}} | ||||||
|
||||||
|
||||||
{{/* | ||||||
Sets extra injector service account annotations | ||||||
|
@@ -731,6 +782,37 @@ Sets extra CSI daemonset annotations | |||||
{{- end }} | ||||||
{{- end -}} | ||||||
|
||||||
{{/* | ||||||
Sets CSI daemonset securityContext for pod template | ||||||
*/}} | ||||||
{{- define "csi.daemonSet.securityContext.pod" -}} | ||||||
{{- if .Values.csi.daemonSet.securityContext.pod }} | ||||||
securityContext: | ||||||
{{- $tp := typeOf .Values.csi.daemonSet.securityContext.pod }} | ||||||
{{- if eq $tp "string" }} | ||||||
{{- tpl .Values.csi.daemonSet.securityContext.pod . | nindent 8 }} | ||||||
{{- else }} | ||||||
{{- toYaml .Values.csi.daemonSet.securityContext.pod | nindent 8 }} | ||||||
{{- end }} | ||||||
{{- end }} | ||||||
{{- end -}} | ||||||
|
||||||
{{/* | ||||||
Sets CSI daemonset securityContext for container | ||||||
*/}} | ||||||
{{- define "csi.daemonSet.securityContext.container" -}} | ||||||
{{- if .Values.csi.daemonSet.securityContext.container }} | ||||||
securityContext: | ||||||
{{- $tp := typeOf .Values.csi.daemonSet.securityContext.container }} | ||||||
{{- if eq $tp "string" }} | ||||||
{{- tpl .Values.csi.daemonSet.securityContext.container . | nindent 12 }} | ||||||
{{- else }} | ||||||
{{- toYaml .Values.csi.daemonSet.securityContext.container | nindent 12 }} | ||||||
{{- end }} | ||||||
{{- end }} | ||||||
{{- end -}} | ||||||
|
||||||
|
||||||
{{/* | ||||||
Sets the injector toleration for pod placement | ||||||
*/}} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably remove this line, since this PR effectively un-deprecates
injector.uid
andinjector.gid
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍