Skip to content

Commit

Permalink
fix: adds security context to init containers; change default to comp…
Browse files Browse the repository at this point in the history
…liant restricted policy (#37)
  • Loading branch information
kramuenke committed Jun 21, 2024
1 parent abc788a commit 1ffb277
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions charts/codezero/templates/lb/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
{{- toYaml .Values.lb.podSecurityContext | nindent 8 }}
initContainers:
- name: wait-for-cert
securityContext:
{{- toYaml .Values.lb.securityContext | nindent 12 }}
image: public.ecr.aws/docker/library/busybox:1.36
command: ["sh", "-c", "for i in `seq 1 20`; do sleep 0.5; if [ -e /etc/ssl/certs/space/server.pem ]; then exit 0; fi; done; exit 1"]
volumeMounts:
Expand Down
2 changes: 2 additions & 0 deletions charts/codezero/templates/orchestrator/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
{{- toYaml .Values.orchestrator.podSecurityContext | nindent 8 }}
initContainers:
- name: wait-for-cert
securityContext:
{{- toYaml .Values.orchestrator.securityContext | nindent 12 }}
image: public.ecr.aws/docker/library/busybox:1.36
command: ["sh", "-c", "for i in `seq 1 20`; do sleep 0.5; if [ -e /etc/ssl/certs/space/ca.pem ]; then exit 0; fi; done; exit 1"]
volumeMounts:
Expand Down
4 changes: 4 additions & 0 deletions charts/codezero/templates/system/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
{{- toYaml .Values.system.podSecurityContext | nindent 8 }}
initContainers:
- name: space-init
securityContext:
{{- toYaml .Values.system.securityContext | nindent 12 }}
image: "c6oio/spaceinit:{{ default .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.system.image.pullPolicy }}
env:
Expand All @@ -44,6 +46,8 @@ spec:
name: space-cert
readOnly: true
- name: wait-for-orchestrator
securityContext:
{{- toYaml .Values.system.securityContext | nindent 12 }}
image: public.ecr.aws/docker/library/busybox:1.36
command: ["sh", "-c", "for i in `seq 1 60`; do if wget --spider --quiet 'http://orchestrator:8900'; then exit 0; fi; sleep 0.5; done; exit 1"]
containers:
Expand Down
24 changes: 20 additions & 4 deletions charts/codezero/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ system:
podLabels: { }

podSecurityContext: { }
securityContext: { }
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
allowPrivilegeEscalation: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

resources: { }
nodeSelector: { }
Expand All @@ -56,7 +65,16 @@ orchestrator:
podLabels: { }

podSecurityContext: { }
securityContext: { }
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
allowPrivilegeEscalation: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

resources: { }
nodeSelector: { }
Expand Down Expand Up @@ -89,8 +107,6 @@ lb:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
seccompProfile:
type: RuntimeDefault

Expand Down

0 comments on commit 1ffb277

Please sign in to comment.