Skip to content

Commit

Permalink
Added the security context at pod and container level for kainster op…
Browse files Browse the repository at this point in the history
…erator

Signed-off-by: Anish Bista <[email protected]>
  • Loading branch information
anishbista60 committed Sep 26, 2024
1 parent 48d034f commit 698d580
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions helm/kanister-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ spec:
labels:
{{ include "kanister-operator.helmLabels" . | indent 8}}
spec:
{{- if .Values.controller.podSecurityContext }}
securityContext:
{{ toYaml .Values.controller.podSecurityContext | indent 8 }}
{{- end }}
serviceAccountName: {{ template "kanister-operator.serviceAccountName" . }}
{{- if or .Values.bpValidatingWebhook.enabled .Values.validatingWebhook.repositoryserver.enabled }}
volumes:
Expand All @@ -29,6 +33,8 @@ spec:
- name: {{ template "kanister-operator.fullname" . }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{ include "controller.containerSecurityContext" . }}
{{- if .Values.bpValidatingWebhook.enabled }}
volumeMounts:
- name: webhook-certs
Expand All @@ -53,6 +59,8 @@ spec:
- name: {{ template "repository-server-controller.name" . }}
image: {{ .Values.repositoryServerControllerImage.registry }}/{{ .Values.repositoryServerControllerImage.name }}:{{ .Values.repositoryServerControllerImage.tag }}
imagePullPolicy: {{ .Values.repositoryServerControllerImage.pullPolicy }}
securityContext:
{{ include "controller.containerSecurityContext" . }}
{{- if .Values.validatingWebhook.repositoryserver.enabled }}
volumeMounts:
- name: webhook-certs
Expand Down
15 changes: 15 additions & 0 deletions helm/kanister-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ controller:
# false : kanister-prometheus framework has been disabled
# true: kanister-prometheus framework has been enabled
enabled: false
# Pod-level security context settings
podSecurityContext:
#runAsUser: 1000
#fsGroup: 2000
#runAsNonRoot: true

# Container-level security context settings
containerSecurityContext:
#capabilities:
# drop:
# - ALL
#readOnlyRootFilesystem: true
#runAsNonRoot: true
#allowPrivilegeEscalation: false
dataStore:
parallelism:
upload: 8
Expand Down Expand Up @@ -89,3 +103,4 @@ tolerations: []
#
# node labels for pod assignment. Evaluated as template
nodeSelector: {}

0 comments on commit 698d580

Please sign in to comment.