Skip to content

Commit 214c5c8

Browse files
committed
fix cni security contexts
1 parent 258ac69 commit 214c5c8

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

internal/assets/manifests/istio-cni/templates/daemonset.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ spec:
111111
name: cni-log-dir
112112
{{ include "toYamlIf" (dict "value" .Values.cni.volumeMounts) | indent 12 }}
113113
{{ include "toYamlIf" (dict "value" .Values.cni.resources "key" "resources" "indent" 2) | indent 10 }}
114+
{{ include "toYamlIf" (dict "value" .Values.cni.securityContext "key" "securityContext" "indent" 2) | indent 10 }}
114115
{{- if .Values.cni.taint.enabled }}
115116
- name: taint-controller
116117
{{- include "dockerImage" (dict "image" .Values.cni.taint.image "hub" .Values.global.hub "tag" .Values.global.tag) | indent 10 -}}

internal/assets/manifests/istio-cni/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ cni:
4444
# Experimental taint controller for further race condition mitigation
4545
taint:
4646
enabled: false
47+
securityContext:
48+
runAsUser: 1337
49+
runAsGroup: 1337
50+
runAsNonRoot: true
4751

4852
resourceQuotas:
4953
enabled: true
@@ -70,7 +74,11 @@ cni:
7074
volumes: []
7175
volumeMounts: []
7276
resources: {}
73-
securityContext: {}
77+
securityContext:
78+
runAsGroup: 0
79+
runAsUser: 0
80+
runAsNonRoot: false
81+
7482
priorityClassName: system-node-critical
7583

7684
# Revision is set as 'version' label and part of the resource names when installing multiple control planes.

internal/components/cni/testdata/icp-expected-resource-dump.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ spec:
320320
requests:
321321
cpu: 100m
322322
memory: 128Mi
323+
securityContext:
324+
runAsGroup: 0
325+
runAsUser: 0
326+
runAsNonRoot: false
327+
allowPrivilegeEscalation: false
323328
- name: taint-controller
324329
image: "gcr.io/istio-testing/install-cni-taint:latest"
325330
imagePullPolicy: Always
@@ -348,6 +353,7 @@ spec:
348353
runAsGroup: 1337
349354
runAsNonRoot: true
350355
runAsUser: 1337
356+
allowPrivilegeEscalation: false
351357
nodeSelector:
352358
kubernetes.io/os: linux
353359
disktype: ssd

internal/components/cni/testdata/icp-expected-values.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ cni:
4242
- name: taint-config-vol
4343
mountPath: /etc/config
4444
securityContext:
45-
runAsGroup: 1337
46-
runAsNonRoot: true
47-
runAsUser: 1337
45+
allowPrivilegeEscalation: false
4846
metadata:
4947
annotations:
5048
daemonset-annotation: value
@@ -113,9 +111,7 @@ cni:
113111
cpu: 100m
114112
memory: 128Mi
115113
securityContext:
116-
runAsGroup: 1337
117-
runAsNonRoot: true
118-
runAsUser: 1337
114+
allowPrivilegeEscalation: false
119115
priorityClassName: system-node-critical
120116
global:
121117
hub: gcr.io/istio-testing

internal/components/cni/testdata/icp-test-cr.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ spec:
4848
cpu: 100m
4949
memory: 128Mi
5050
securityContext:
51-
runAsUser: 1337
52-
runAsGroup: 1337
53-
runAsNonRoot: true
51+
allowPrivilegeEscalation: false
5452
volumeMounts:
5553
- name: taint-config-vol
5654
mountPath: /etc/config
@@ -133,7 +131,5 @@ spec:
133131
cpu: 100m
134132
memory: 128Mi
135133
securityContext:
136-
runAsUser: 1337
137-
runAsGroup: 1337
138-
runAsNonRoot: true
134+
allowPrivilegeEscalation: false
139135
priorityClassName: system-node-critical

0 commit comments

Comments
 (0)