Skip to content

Commit 7e1de2b

Browse files
committed
feat: centralize security contexts
1 parent 059e5d6 commit 7e1de2b

11 files changed

Lines changed: 43 additions & 40 deletions

helm-chart/renku/templates/_certificates-init-container.tpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
- name: init-certificates
44
image: "{{ .Values.global.certificates.image.repository }}:{{ .Values.global.certificates.image.tag }}"
55
securityContext:
6-
allowPrivilegeEscalation: false
7-
runAsUser: 1000
8-
runAsGroup: 1000
9-
runAsNonRoot: true
6+
{{- toYaml .Values.securityContext | nindent 4 }}
107
volumeMounts:
118
- name: etc-ssl-certs
129
mountPath: /etc/ssl/certs/

helm-chart/renku/templates/setup-job-authz-db.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ spec:
1818
chart: {{ template "renku.chart" . }}
1919
spec:
2020
restartPolicy: Never
21+
securityContext:
22+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2123
containers:
2224
- name: initialize-postgres-authz
2325
image: "{{ .Values.initDb.image.repository }}:{{ .Values.initDb.image.tag }}"
2426
args: [ "authz_db_init.py" ]
2527
securityContext:
26-
runAsUser: 1000
27-
runAsGroup: 1000
28-
allowPrivilegeEscalation: false
29-
runAsNonRoot: true
28+
{{- toYaml .Values.securityContext | nindent 12 }}
3029
env:
3130
- name: DB_HOST
3231
value: {{ template "postgresql.fullname" . }}

helm-chart/renku/templates/setup-job-keycloak-db.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ spec:
1919
chart: {{ template "renku.chart" . }}
2020
spec:
2121
restartPolicy: Never
22+
securityContext:
23+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2224
containers:
2325
- name: initialize-postgres-keycloak
2426
image: "{{ .Values.initDb.image.repository }}:{{ .Values.initDb.image.tag }}"
2527
args: [ "keycloak_db_init.py" ]
2628
securityContext:
27-
runAsUser: 1000
28-
runAsGroup: 1000
29-
allowPrivilegeEscalation: false
30-
runAsNonRoot: true
29+
{{- toYaml .Values.securityContext | nindent 12 }}
3130
env:
3231
- name: DB_HOST
3332
value: {{ template "postgresql.fullname" . }}

helm-chart/renku/templates/setup-job-keycloak-realms.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ spec:
2020
chart: {{ template "renku.chart" . }}
2121
spec:
2222
restartPolicy: Never
23+
securityContext:
24+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2325
initContainers:
2426
{{- include "certificates.initContainer" . | nindent 8 }}
2527
containers:
2628
- name: init-keycloak
2729
image: "{{ .Values.keycloakx.initRealm.image.repository }}:{{ .Values.keycloakx.initRealm.image.tag }}"
2830
securityContext:
29-
runAsUser: 1000
30-
runAsGroup: 1000
31-
allowPrivilegeEscalation: false
32-
runAsNonRoot: true
31+
{{- toYaml .Values.securityContext | nindent 12 }}
3332
command: ["python"]
3433
args: [
3534
"/app/init-realm.py",

helm-chart/renku/templates/setup-job-platform-init.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ spec:
2020
chart: {{ template "renku.chart" . }}
2121
spec:
2222
restartPolicy: Never
23+
securityContext:
24+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2325
containers:
2426
- name: initialize-platform
2527
image: "{{ .Values.platformInit.image.repository }}:{{ .Values.platformInit.image.tag }}"
2628
args: [ "platform-init.py" ]
2729
securityContext:
28-
runAsUser: 1000
29-
runAsGroup: 1000
30-
allowPrivilegeEscalation: false
31-
runAsNonRoot: true
30+
{{- toYaml .Values.securityContext | nindent 12 }}
3231
env:
3332
- name: K8S_NAMESPACE
3433
value: {{ .Release.Namespace }}

helm-chart/renku/templates/setup-job-renku-dbs.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ spec:
1818
chart: {{ template "renku.chart" . }}
1919
spec:
2020
restartPolicy: Never
21+
securityContext:
22+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2123
containers:
2224
- name: initialize-postgres-renku
2325
image: "{{ .Values.initDb.image.repository }}:{{ .Values.initDb.image.tag }}"
2426
args: [ "renku_db_init.py" ]
2527
securityContext:
26-
runAsUser: 1000
27-
runAsGroup: 1000
28-
allowPrivilegeEscalation: false
29-
runAsNonRoot: true
28+
{{- toYaml .Values.securityContext | nindent 12 }}
3029
env:
3130
- name: DB_HOST
3231
value: {{ template "postgresql.fullname" . }}

helm-chart/renku/templates/tests/test-renku.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ metadata:
77
annotations:
88
"helm.sh/hook": test
99
spec:
10+
securityContext:
11+
{{- toYaml .Values.podSecurityContext | nindent 4 }}
1012
volumes:
1113
- name: dshm
1214
emptyDir:
@@ -15,6 +17,8 @@ spec:
1517
containers:
1618
- name: sbt
1719
image: {{ .Values.tests.image.repository }}:{{ .Values.tests.image.tag }}
20+
securityContext:
21+
{{- toYaml .Values.securityContext | nindent 6 }}
1822
env:
1923
- name: RENKU_TEST_URL
2024
value: '{{ template "renku.http" . }}://{{ .Values.global.renku.domain }}'

helm-chart/renku/templates/ui/ui-client-deployment-template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ spec:
141141
resources:
142142
{{ toYaml .Values.ui.client.resources | indent 12 }}
143143
securityContext:
144-
{{- toYaml .Values.ui.client.securityContext | nindent 12 }}
144+
{{- toYaml .Values.securityContext | nindent 12 }}
145145
{{- with .Values.ui.client.nodeSelector }}
146146
nodeSelector:
147147
{{ toYaml . | indent 8 }}
@@ -155,7 +155,7 @@ spec:
155155
{{ toYaml . | indent 8 }}
156156
{{- end }}
157157
securityContext:
158-
{{- toYaml .Values.ui.client.podSecurityContext | nindent 8 }}
158+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
159159
{{- if .Values.ui.client.image.pullSecrets }}
160160
imagePullSecrets:
161161
{{- range .Values.ui.client.image.pullSecrets }}

helm-chart/renku/templates/ui/ui-server-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ spec:
2929
{{- toYaml . | nindent 8 }}
3030
{{- end }}
3131
securityContext:
32-
{{- toYaml .Values.ui.server.podSecurityContext | nindent 8 }}
32+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
3333
automountServiceAccountToken: {{ .Values.global.debug }}
3434
initContainers:
3535
{{- include "certificates.initContainer" . | nindent 8 }}
3636
containers:
3737
- name: {{ .Chart.Name }}
3838
securityContext:
39-
{{- toYaml .Values.ui.server.securityContext | nindent 12 }}
39+
{{- toYaml .Values.securityContext | nindent 12 }}
4040
image: "{{ .Values.ui.server.image.repository }}:{{ .Values.ui.server.image.tag }}"
4141
imagePullPolicy: {{ .Values.ui.server.image.pullPolicy }}
4242
ports:

helm-chart/renku/values.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,6 @@ ui:
564564
nodeSelector: {}
565565
tolerations: []
566566
affinity: {}
567-
podSecurityContext: {}
568-
securityContext:
569-
runAsUser: 1000
570-
runAsNonRoot: true
571-
allowPrivilegeEscalation: false
572567
# This defines the message displayed on the home page of logged in users.
573568
dashboardMessage:
574569
enabled: false
@@ -736,12 +731,6 @@ ui:
736731
# The name of the service account to use.
737732
# If not set and create is true, a name is generated using the fullname template
738733
name: ""
739-
podSecurityContext: {}
740-
securityContext:
741-
runAsUser: 1000
742-
runAsGroup: 1000
743-
runAsNonRoot: true
744-
allowPrivilegeEscalation: false
745734
service:
746735
type: ClusterIP
747736
port: 80
@@ -1604,6 +1593,9 @@ securityContext:
16041593
runAsGroup: 1000
16051594
runAsNonRoot: true
16061595
allowPrivilegeEscalation: false
1596+
capabilities:
1597+
drop:
1598+
- ALL
16071599
nodeSelector: {}
16081600
tolerations: []
16091601
affinity: {}

0 commit comments

Comments
 (0)