Skip to content

Commit 7fa2177

Browse files
Add Startup Volume Permission Enforcement (#482)
* add volume permissions * fix variables for parent persistence * more global variables * rename init container * refactor volume permissions container to extraInitContainers
1 parent 9787943 commit 7fa2177

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

charts/netdata/templates/parent/deployment.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
{{- end }}
3636
spec:
3737
securityContext:
38-
fsGroup: 201
38+
fsGroup: {{ .Values.parent.securityContext.fsGroup }}
3939
serviceAccountName: {{ .Values.serviceAccount.name }}
4040
{{- if .Values.parent.priorityClassName }}
4141
priorityClassName: "{{ .Values.parent.priorityClassName }}"
@@ -58,6 +58,7 @@ spec:
5858
resources:
5959
{{ toYaml .Values.sysctlInitContainer.resources | indent 12 }}
6060
{{- end }}
61+
{{ toYaml .Values.parent.extraInitContainers | indent 8 }}
6162
containers:
6263
- name: {{ .Chart.Name }}
6364
image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
@@ -117,6 +118,9 @@ spec:
117118
periodSeconds: {{ .Values.parent.readinessProbe.periodSeconds }}
118119
successThreshold: {{ .Values.parent.readinessProbe.successThreshold }}
119120
timeoutSeconds: {{ .Values.parent.readinessProbe.timeoutSeconds }}
121+
securityContext:
122+
runAsUser: {{ .Values.parent.securityContext.runAsUser }}
123+
runAsGroup: {{ .Values.parent.securityContext.runAsGroup }}
120124
volumeMounts:
121125
- name: os-release
122126
mountPath: /host/etc/os-release

charts/netdata/values.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ingress:
6262
path: /
6363
pathType: Prefix
6464
hosts:
65-
- netdata.k8s.local
65+
- netdata.k8s.local
6666
## whole spec is going to be included into ingress spec.
6767
## if you intend to use ingressClassName declaration, remove ingress.class from annotations
6868
# spec:
@@ -129,6 +129,10 @@ parent:
129129
periodSeconds: 30
130130
successThreshold: 1
131131
timeoutSeconds: 1
132+
securityContext:
133+
runAsUser: 201
134+
runAsGroup: 201
135+
fsGroup: 201
132136

133137
terminationGracePeriodSeconds: 300
134138

@@ -236,6 +240,8 @@ parent:
236240

237241
extraVolumes: []
238242

243+
extraInitContainers: []
244+
239245
child:
240246
enabled: true
241247
port: "{{ .Values.parent.port }}"
@@ -270,8 +276,8 @@ child:
270276
nodeSelector: {}
271277

272278
tolerations:
273-
- operator: Exists
274-
effect: NoSchedule
279+
- operator: Exists
280+
effect: NoSchedule
275281

276282
affinity: {}
277283

0 commit comments

Comments
 (0)