Skip to content

Commit 2805f3c

Browse files
authored
Merge pull request #499 from kosli-dev/update-helm-chart-for-more-security-context-control
Allow more control over security context
2 parents 1a99e7c + a990e84 commit 2805f3c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

charts/k8s-reporter/templates/cronjob.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,24 @@ spec:
2020
- name: reporter
2121
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
2222
imagePullPolicy: {{ .Values.image.pullPolicy }}
23+
{{- if .Values.reporterConfig.securityContext }}
2324
securityContext:
25+
{{- if hasKey .Values.reporterConfig.securityContext "allowPrivilegeEscalation" }}
2426
allowPrivilegeEscalation: {{ .Values.reporterConfig.securityContext.allowPrivilegeEscalation }}
27+
{{- end }}
28+
{{- if hasKey .Values.reporterConfig.securityContext "runAsNonRoot" }}
2529
runAsNonRoot: {{ .Values.reporterConfig.securityContext.runAsNonRoot }}
30+
{{- end }}
31+
{{- if hasKey .Values.reporterConfig.securityContext "runAsUser" }}
2632
runAsUser: {{ .Values.reporterConfig.securityContext.runAsUser }}
33+
{{- end }}
34+
{{- if hasKey .Values.reporterConfig.securityContext "runAsGroup" }}
35+
runAsGroup: {{ .Values.reporterConfig.securityContext.runAsGroup }}
36+
{{- end }}
37+
{{- if hasKey .Values.reporterConfig.securityContext "fsGroup" }}
38+
fsGroup: {{ .Values.reporterConfig.securityContext.fsGroup }}
39+
{{- end }}
40+
{{- end }}
2741
env:
2842
- name: KOSLI_ORG
2943
value: {{ required ".Values.reporterConfig.kosliOrg is required" .Values.reporterConfig.kosliOrg }}
@@ -59,3 +73,4 @@ spec:
5973
resources:
6074
{{ toYaml .Values.resources | indent 14 }}
6175
restartPolicy: Never
76+

charts/k8s-reporter/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ reporterConfig:
5656
httpProxy: ""
5757

5858
# -- the security context for the reporter cronjob
59+
# Set to null or {} to disable security context entirely (not recommended)
60+
# For OpenShift, you can omit runAsUser to let OpenShift assign the UID
5961
securityContext:
6062
# -- whether to allow privilege escalation
6163
allowPrivilegeEscalation: false
6264
# -- whether to run as non root
6365
runAsNonRoot: true
6466
# -- the user id to run as
67+
# Omit this field for OpenShift environments to allow automatic UID assignment
6568
runAsUser: 1000
6669

6770
# Uncomment the env variable below and replace <instance_name>, if you are on a single tenant Kosli instance

0 commit comments

Comments
 (0)