Skip to content

Commit

Permalink
Update securityContext for workergroup template
Browse files Browse the repository at this point in the history
  • Loading branch information
bdalpe committed Jul 14, 2023
1 parent 4466786 commit 1700ab9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
27 changes: 18 additions & 9 deletions helm-chart-sources/logstream-workergroup/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@ initContainers:
{{- if .Values.config.hostNetwork }}
hostNetwork: true
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
{{- range $key, $value := .Values.podSecurityContext }}
{{- if or (eq $key "runAsUser") (eq $key "runAsGroup") (eq $key "fsGroup")}}
{{ $key }}: {{ $value | int }}
{{- else }}
{{ $key }}: {{ $value | int }}
{{- end }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.criblImage.repository }}:{{ .Values.criblImage.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.criblImage.pullPolicy }}
{{- if .Values.securityContext }}
command:
- bash
- -c
- |
set -x
apt update; apt-get install -y gosu
useradd -d /opt/cribl -g "{{- .Values.securityContext.runAsGroup }}" -u "{{- .Values.securityContext.runAsUser }}" cribl
chown -R "{{- .Values.securityContext.runAsUser }}:{{- .Values.securityContext.runAsGroup }}" /opt/cribl
gosu "{{- .Values.securityContext.runAsUser }}:{{- .Values.securityContext.runAsGroup }}" /sbin/entrypoint.sh cribl
securityContext:
{{- range $key, $value := .Values.securityContext }}
{{- if or (eq $key "runAsUser") (eq $key "runAsGroup") (eq $key "fsGroup")}}
{{ $key }}: {{ $value | int }}
{{- else }}
{{ $key }}: {{ $value | int }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.config.probes }}
{{- with .Values.config.livenessProbe }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
securityContext:
runAsUser: 1000620000
runAsGroup: 1000620000

podSecurityContext:
runAsUser: 1000
runAsGroup: 1000

0 comments on commit 1700ab9

Please sign in to comment.