Skip to content

Commit

Permalink
Merge pull request #65 from spielkind/feature/security_context
Browse files Browse the repository at this point in the history
helm: added securityContext to run containers AsNonRoot
  • Loading branch information
baurmatt authored Feb 21, 2024
2 parents 0deef33 + 3363d73 commit 1762f14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions helm/designate-certmanager-webhook/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "designate-certmanager-webhook.fullname" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: wait-for-tls-secret
image: "{{ .Values.alpine.image.repository }}:{{ .Values.alpine.image.tag }}"
Expand All @@ -37,6 +39,8 @@ spec:
args:
- -c
- "while [ ! -f /tls/tls.key ]; do sleep 5; done"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
- name: add-apiservice
image: "{{ .Values.kubectl.image.repository }}:{{ .Values.kubectl.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand All @@ -50,6 +54,8 @@ spec:
- apply
- -f
- /config/apiservice.yaml
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down Expand Up @@ -80,6 +86,8 @@ spec:
readOnly: true
resources:
{{ toYaml .Values.resources | indent 12 }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumes:
- name: apiservice-config
configMap:
Expand Down
13 changes: 13 additions & 0 deletions helm/designate-certmanager-webhook/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ service:
type: ClusterIP
port: 443

podSecurityContext:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 1000

securityContext:
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000

resources: {}
# limits:
# cpu: 100m
Expand Down

0 comments on commit 1762f14

Please sign in to comment.