Skip to content

Commit 3406986

Browse files
Intel Changes
1 parent 6b8c206 commit 3406986

2 files changed

Lines changed: 64 additions & 4 deletions

File tree

charts/intel/templates/deployment.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,56 @@ spec:
2727
- name: {{ include "codetogether.fullname" . }}-pull-secret
2828
{{- end }}
2929
serviceAccountName: {{ include "codetogether.serviceAccountName" . }}
30+
{{- if .Values.openshift.enabled }}
31+
# OpenShift
32+
{{- else if .Values.podSecurityContext }}
33+
securityContext:
34+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
35+
{{- end }}
36+
{{- if .Values.securityContext.readOnlyRootFilesystem }}
37+
initContainers:
38+
- name: prepare-runtime
39+
image: busybox:1.36
40+
command: ["/bin/sh","-c"]
41+
args:
42+
{{- if .Values.openshift.enabled }}
43+
- |
44+
set -eu
45+
for d in \
46+
/run \
47+
/var/log/nginx \
48+
/var/cache/nginx
49+
do
50+
install -d -m 0775 "$d"
51+
done
52+
{{- else }}
53+
- |
54+
set -eu
55+
for d in \
56+
/run \
57+
/var/log/nginx \
58+
/var/cache/nginx
59+
do
60+
install -d -m 0775 "$d"
61+
done
62+
chown -R {{ default 1000 .Values.securityContext.runAsUser }}:{{ default 1000 .Values.securityContext.runAsGroup | default 1000 }} \
63+
/run /var/log/nginx /var/cache/nginx
64+
{{- end }}
65+
securityContext:
66+
{{- if .Values.openshift.enabled }}
67+
runAsNonRoot: true
68+
allowPrivilegeEscalation: false
69+
{{- else }}
70+
runAsUser: 0
71+
runAsGroup: 0
72+
runAsNonRoot: false
73+
allowPrivilegeEscalation: false
74+
{{- end }}
75+
volumeMounts:
76+
- { name: codetogether-runtime, mountPath: /run }
77+
- { name: codetogether-runtime, mountPath: /var/log/nginx }
78+
- { name: codetogether-runtime, mountPath: /var/cache/nginx }
79+
{{- end }}
3080
containers:
3181
- name: {{ .Chart.Name }}
3282
securityContext:

charts/intel/values.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,24 @@ serviceAccount:
132132

133133
podAnnotations: {}
134134

135-
securityContext: {} #defaults to
135+
# Enable if deploying in OpenShift
136+
openshift:
137+
enabled: false
136138

139+
securityContext: {} #defaults
137140
# capabilities:
138141
# drop:
139142
# - ALL
140-
#readOnlyRootFilesystem: true # enable for read-only setup
141-
# runAsNonRoot: true # false for non-root user
142-
# runAsUser: 0 # Use '0' for root user for read-only setup
143+
# readOnlyRootFilesystem: true # enable for read-only setup
144+
# runAsNonRoot: true
145+
# runAsUser: 1000 # Use '0' for root user, in vanilla k8s you can use any non-root uid
146+
# runAsGroup: 1000
147+
# In openshift, dont set runAsUser or runAsGroup, let OpenShift assign the values
148+
149+
podSecurityContext: {}
150+
# In OpenShift will inject automatically
151+
#fsGroup: 1000
152+
#fsGroupChangePolicy: "OnRootMismatch"
143153

144154
ai:
145155
enabled: false

0 commit comments

Comments
 (0)