|
45 | 45 | securityContext: |
46 | 46 | seccompProfile: |
47 | 47 | type: RuntimeDefault |
| 48 | +{{- if .Values.controller.readOnlyRootFilesystem }} |
| 49 | + fsGroup: 101 #nginx |
| 50 | +{{- end }} |
48 | 51 | sysctls: |
49 | 52 | - name: "net.ipv4.ip_unprivileged_port_start" |
50 | 53 | value: "0" |
|
61 | 64 | affinity: |
62 | 65 | {{ toYaml .Values.controller.affinity | indent 8 }} |
63 | 66 | {{- end }} |
64 | | -{{- if or .Values.controller.volumes .Values.nginxServiceMesh.enable }} |
| 67 | +{{- if or .Values.controller.readOnlyRootFilesystem .Values.nginxServiceMesh.enable .Values.controller.volumes }} |
65 | 68 | volumes: |
66 | 69 | {{- end }} |
| 70 | +{{- if .Values.controller.readOnlyRootFilesystem }} |
| 71 | + - name: nginx-etc |
| 72 | + emptyDir: {} |
| 73 | + - name: nginx-cache |
| 74 | + emptyDir: {} |
| 75 | + - name: nginx-lib |
| 76 | + emptyDir: {} |
| 77 | + - name: nginx-log |
| 78 | + emptyDir: {} |
| 79 | +{{- end }} |
67 | 80 | {{- if .Values.nginxServiceMesh.enable }} |
68 | 81 | - hostPath: |
69 | 82 | path: /run/spire/sockets |
@@ -116,14 +129,25 @@ spec: |
116 | 129 | {{- end }} |
117 | 130 | securityContext: |
118 | 131 | allowPrivilegeEscalation: false |
| 132 | + readOnlyRootFilesystem: {{ .Values.controller.readOnlyRootFilesystem }} |
119 | 133 | runAsUser: 101 #nginx |
120 | 134 | runAsNonRoot: true |
121 | 135 | capabilities: |
122 | 136 | drop: |
123 | 137 | - ALL |
124 | | -{{- if or .Values.controller.volumeMounts .Values.nginxServiceMesh.enable }} |
| 138 | +{{- if or .Values.controller.readOnlyRootFilesystem .Values.nginxServiceMesh.enable .Values.controller.volumeMounts }} |
125 | 139 | volumeMounts: |
126 | 140 | {{- end }} |
| 141 | +{{- if .Values.controller.readOnlyRootFilesystem }} |
| 142 | + - mountPath: /etc/nginx |
| 143 | + name: nginx-etc |
| 144 | + - mountPath: /var/cache/nginx |
| 145 | + name: nginx-cache |
| 146 | + - mountPath: /var/lib/nginx |
| 147 | + name: nginx-lib |
| 148 | + - mountPath: /var/log/nginx |
| 149 | + name: nginx-log |
| 150 | +{{- end }} |
127 | 151 | {{- if .Values.nginxServiceMesh.enable }} |
128 | 152 | - mountPath: /run/spire/sockets |
129 | 153 | name: spire-agent-socket |
@@ -239,8 +263,28 @@ spec: |
239 | 263 | {{- if .Values.controller.extraContainers }} |
240 | 264 | {{ toYaml .Values.controller.extraContainers | nindent 6 }} |
241 | 265 | {{- end }} |
| 266 | +{{- if or .Values.controller.readOnlyRootFilesystem .Values.controller.initContainers }} |
| 267 | + initContainers: |
| 268 | +{{- end }} |
| 269 | +{{- if .Values.controller.readOnlyRootFilesystem }} |
| 270 | + - name: init-{{ include "nginx-ingress.name" . }} |
| 271 | + image: {{ include "nginx-ingress.image" . }} |
| 272 | + imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}" |
| 273 | + command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc'] |
| 274 | + securityContext: |
| 275 | + allowPrivilegeEscalation: false |
| 276 | + readOnlyRootFilesystem: true |
| 277 | + runAsUser: 101 #nginx |
| 278 | + runAsNonRoot: true |
| 279 | + capabilities: |
| 280 | + drop: |
| 281 | + - ALL |
| 282 | + volumeMounts: |
| 283 | + - mountPath: /mnt/etc |
| 284 | + name: nginx-etc |
| 285 | +{{- end }} |
242 | 286 | {{- if .Values.controller.initContainers }} |
243 | | - initContainers: {{ toYaml .Values.controller.initContainers | nindent 8 }} |
| 287 | +{{ toYaml .Values.controller.initContainers | indent 6 }} |
244 | 288 | {{- end }} |
245 | 289 | {{- if .Values.controller.strategy }} |
246 | 290 | updateStrategy: |
|
0 commit comments