Skip to content

Commit

Permalink
feat: adjust spec.template.spec.securityContext (#465)
Browse files Browse the repository at this point in the history
* Move runAsNonRoot to values.yaml and add support for runAsUser/runAsGroup

Signed-off-by: ChristianBieri1995 <[email protected]>

* Adjust spec.template.spec.securityContext

Signed-off-by: ChristianBieri1995 <[email protected]>

---------

Signed-off-by: ChristianBieri1995 <[email protected]>
Co-authored-by: Aris Boutselis <[email protected]>
Co-authored-by: Alex Jones <[email protected]>
  • Loading branch information
3 people authored Oct 22, 2024
1 parent 0727ec6 commit e92a69f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chart/operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ spec:
}}
securityContext: {{- toYaml .Values.controllerManager.manager.containerSecurityContext
| nindent 10 }}
{{- if .Values.controllerManager.podSecurityContext }}
securityContext:
runAsNonRoot: true
{{- toYaml .Values.controllerManager.podSecurityContext | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "chart.fullname" . }}-controller-manager
terminationGracePeriodSeconds: 10
{{- if .Values.controllerManager.nodeSelector }}
Expand Down
5 changes: 5 additions & 0 deletions chart/operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ controllerManager:
## ref: https://kubernetes.io/docs/user-guide/node-selection/
#
nodeSelector: {}
podSecurityContext:
runAsNonRoot: true
# Set securityContext.runAsUser/runAsGroup if necessary. Values below were taken from https://github.com/k8sgpt-ai/k8sgpt-operator/blob/main/Dockerfile
# runAsUser: 65532
# runAsGroup: 65532
kubernetesClusterDomain: cluster.local
metricsService:
ports:
Expand Down

0 comments on commit e92a69f

Please sign in to comment.