Skip to content

Commit 88823b5

Browse files
Make cleaner job securityContext OpenShift-compatible
Signed-off-by: Md. Istiak <mdistiak@appscode.com>
1 parent 35f3b3a commit 88823b5

2 files changed

Lines changed: 27 additions & 13 deletions

File tree

charts/service-gateway/templates/cleaner/job.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@ spec:
1515
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
1616
serviceAccountName: {{ include "service-gateway.fullname" . }}-gwclass-cleaner
1717
automountServiceAccountToken: true
18+
{{- if eq "true" ( include "distro.openshift" . ) }}
1819
securityContext:
19-
runAsNonRoot: true
20-
runAsUser: 65534
21-
seccompProfile:
22-
type: RuntimeDefault
20+
{{- toYaml (omit .Values.cleaner.podSecurityContext "runAsUser" "runAsGroup" "fsGroup" "supplementalGroups") | nindent 8 }}
21+
{{- else }}
22+
securityContext:
23+
{{- toYaml .Values.cleaner.podSecurityContext | nindent 8 }}
24+
{{- end }}
2325
containers:
2426
- name: kubectl
27+
{{- if eq "true" ( include "distro.openshift" . ) }}
28+
securityContext:
29+
{{- toYaml (omit .Values.cleaner.securityContext "runAsUser" "runAsGroup" "fsGroup" "supplementalGroups") | nindent 12 }}
30+
{{- else }}
2531
securityContext:
26-
allowPrivilegeEscalation: false
27-
capabilities:
28-
drop: ["ALL"]
29-
privileged: false
30-
readOnlyRootFilesystem: true
31-
runAsNonRoot: true
32-
runAsUser: 65534
33-
seccompProfile:
34-
type: RuntimeDefault
32+
{{- toYaml .Values.cleaner.securityContext | nindent 12 }}
33+
{{- end }}
3534
image: "{{ include "kubectl.registry" . }}/{{ .Values.kubectl.repository }}:{{ .Values.kubectl.tag }}"
3635
imagePullPolicy: {{ .Values.kubectl.pullPolicy }}
3736
command:

charts/service-gateway/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,18 @@ kubectl:
168168
# and shuts down before it can remove the finalizer.
169169
cleaner:
170170
enabled: false
171+
podSecurityContext:
172+
runAsNonRoot: true
173+
runAsUser: 65534
174+
seccompProfile:
175+
type: RuntimeDefault
176+
securityContext:
177+
allowPrivilegeEscalation: false
178+
capabilities:
179+
drop: ["ALL"]
180+
privileged: false
181+
readOnlyRootFilesystem: true
182+
runAsNonRoot: true
183+
runAsUser: 65534
184+
seccompProfile:
185+
type: RuntimeDefault

0 commit comments

Comments
 (0)