8000 remove helm test for shared pvc, create nginx-cache for statefulset b… · nginx/kubernetes-ingress@8d7553c · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d7553c

Browse files
committed
remove helm test for shared pvc, create nginx-cache for statefulset by default
Signed-off-by: Haywood Shannon <5781935+haywoodsh@users.noreply.github.com> Signed-off-by: Haywood Shannon <5781935+haywoodsh@users.noreply.github.com>
1 parent b7c5547 commit 8d7553c

10 files changed

+1204
-2141
lines changed

charts/nginx-ingress/templates/_helpers.tpl

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -388,31 +388,20 @@ volumes:
388388
List of volumes for controller.
389389
*/}}
390390
{{- define "nginx-ingress.volumeEntries" -}}
391-
{{- /* detect if a VCT named nginx-cache exists */ -}}
392-
{{- $flags := dict "hasCacheVCT" false -}}
393-
{{- range $i, $tpl := (.Values.controller.statefulset.volumeClaimTemplates | default (list)) -}}
394-
{{- if eq (default "" $tpl.metadata.name) "nginx-cache" -}}
395-
{{- $_ := set $flags "hasCacheVCT" true -}}
396-
{{- end -}}
397-
{{- end -}}
398-
399391
{{- if eq (include "nginx-ingress.readOnlyRootFilesystem" .) "true" }}
400392
- name: nginx-etc
401393
emptyDir: {}
402-
{{- if .Values.controller.cache.enableShared }}
403-
- name: nginx-cache
404-
persistentVolumeClaim:
405-
claimName: {{ .Values.controller.cache.sharedPVCName }}
406-
{{- else if not (get $flags "hasCacheVCT") }}
407-
- name: nginx-cache
408-
emptyDir: {}
409-
{{- end }}
410394
- name: nginx-lib
411395
emptyDir: {}
412396
- name: nginx-state
413397
emptyDir: {}
414398
- name: nginx-log
415399
emptyDir: {}
400+
{{- /* For StatefulSet, nginx-cache volume is always provided via volumeClaimTemplates */ -}}
401+
{{- if ne .Values.controller.kind "statefulset" }}
402+
- name: nginx-cache
403+
emptyDir: {}
404+
{{- end }}
416405
{{- end }}
417406
{{- if .Values.controller.appprotect.v5 }}
418407
{{ toYaml .Values.controller.appprotect.volumes }}
@@ -472,6 +461,9 @@ volumeMounts:
472461
name: nginx-state
473462
- mountPath: /var/log/nginx
474463
name: nginx-log
464+
{{- else if eq .Values.controller.kind "statefulset" }}
465+
- mountPath: /var/cache/nginx
466+
name: nginx-cache
475467
{{- end }}
476468
{{- if .Values.controller.appprotect.v5 }}
477469
- name: app-protect-bd-config

charts/nginx-ingress/templates/controller-statefulset.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,16 @@ spec:
225225
persistentVolumeClaimRetentionPolicy:
226226
{{ toYaml .Values.controller.statefulset.persistentVolumeClaimRetentionPolicy | indent 4 }}
227227
{{- end }}
228-
{{- if .Values.controller.statefulset.volumeClaimTemplates }}
229228
volumeClaimTemplates:
229+
- metadata:
230+
name: nginx-cache
231+
spec:
232+
accessModes: [ "ReadWriteOnce" ]
233+
storageClassName: "standard"
234+
resources:
235+
requests:
236+
storage: 256Mi
237+
{{- if .Values.controller.statefulset.volumeClaimTemplates }}
230238
{{ toYaml .Values.controller.statefulset.volumeClaimTemplates | indent 2 }}
231239
{{- end }}
232240
{{- end }}

0 commit comments

Comments
 (0)
0