2222 spec :
2323 serviceAccountName : custom-varnish-cache
2424 securityContext :
25- fsGroup : 999
25+ fsGroup : 101
2626 shareProcessNamespace : true
27+ initContainers :
28+ - name : init-script
29+ image : alpine:latest
30+ securityContext :
31+ runAsNonRoot : true
32+ runAsUser : 103
33+ command : ['sh', '-c', 'touch /var/log/varnish/varnishncsa-frontend.log /var/log/varnish/varnishncsa-backend.log && chmod 666 /var/log/varnish/*.log']
34+ volumeMounts :
35+ - name : varnish-log
36+ mountPath : /var/log/varnish
2737 containers :
2838 - name : nginx
2939 image : {{ .Values.nginxImage }}
3747 - name : varnish-cache
3848 securityContext :
3949 runAsNonRoot : true
40- runAsUser : 1002
50+ runAsUser : 103
4151 image : {{ .Values.varnishImage }}
4252 imagePullPolicy : IfNotPresent
4353 ports :
5969 mountPath : " /etc/varnish/default.vcl"
6070 subPath : default.vcl
6171 - name : custom-varnish-vsm
62- mountPath : /var/lib/varnish
72+ mountPath : /var/lib/varnish
73+ - name : varnish-log
74+ mountPath : /var/log/varnish
6375 - name : exporter
6476 command :
6577 - " /prometheus_varnish_exporter"
7385 subPath : secret
7486 ports :
7587 - containerPort : 9131
76- name : prometheus
88+ name : prometheus
89+ - name : varnish-cache-ncsa-frontend
90+ securityContext :
91+ runAsNonRoot : true
92+ runAsUser : 103
93+ image : {{ .Values.varnishImage }}
94+ imagePullPolicy : IfNotPresent
95+ command : ["/bin/sh", "-c"]
96+ args : ["varnishncsa -n /var/lib/varnish -F '{\"Timestamp\": \"%t\", \"Varnish-Side\": \"%{Varnish:side}x\", \"Age\": %{age}o, \"Handling\": \"%{Varnish:handling}x\", \"Request\": \"%r\", \"Status\": \"%s\", \"Response-Reason\": \"%{VSL:RespReason}x\", \"Fetch-Error\": \"%{VSL:FetchError}x\", \"X-Forwarded-For\": \"%{x-forwarded-for}i\", \"Remote-User\": \"%u\", \"Bytes\": \"%b\", \"Time-To-Serve\": %D, \"User-Agent\": \"%{User-agent}i\", \"Referer\": \"%{Referer}i\", \"X-Varnish\": \"%{x-varnish}o\", \"X-Magento-Tags\": \"%{x-magento-tags}o\"}' -w /var/log/varnish/varnishncsa-frontend.log"]
97+ volumeMounts :
98+ - name : custom-varnish-vsm
99+ mountPath : /var/lib/varnish
100+ readOnly : true
101+ - name : varnish-secret
102+ mountPath : /etc/varnish/secret
103+ subPath : secret
104+ - name : varnish-log
105+ mountPath : /var/log/varnish
106+ - name : varnish-cache-ncsa-backend
107+ securityContext :
108+ runAsNonRoot : true
109+ runAsUser : 103
110+ image : {{ .Values.varnishImage }}
111+ imagePullPolicy : IfNotPresent
112+ command : ["/bin/sh", "-c"]
113+ args : ["varnishncsa -n /var/lib/varnish -b -F '{\"Timestamp\": \"%t\", \"Varnish-Side\": \"%{Varnish:side}x\", \"Handling\": \"%{Varnish:handling}x\", \"Request\": \"%r\", \"Status\": \"%s\", \"Response-Reason\": \"%{VSL:RespReason}x\", \"Fetch-Error\": \"%{VSL:FetchError}x\", \"Bytes\": \"%b\", \"Time-To-Serve\": %D}' -w /var/log/varnish/varnishncsa-backend.log"]
114+ volumeMounts :
115+ - name : custom-varnish-vsm
116+ mountPath : /var/lib/varnish
117+ readOnly : true
118+ - name : varnish-secret
119+ mountPath : /etc/varnish/secret
120+ subPath : secret
121+ - name : varnish-log
122+ mountPath : /var/log/varnish
123+ - name : alloy-varnish-logs
124+ image : grafana/alloy:latest
125+ volumeMounts :
126+ - name : varnish-log
127+ mountPath : /var/log/varnish
128+ - name : alloy-varnish-log-config
129+ mountPath : /etc/alloy/config.alloy
130+ subPath : config.alloy
77131 volumes :
78132 - name : custom-config
79133 emptyDir :
@@ -90,6 +144,14 @@ spec:
90144 - name : nginx-config
91145 configMap :
92146 name : nginx-config
147+ - name : varnish-log
148+ emptyDir : {}
149+ - name : alloy-varnish-log-config
150+ configMap :
151+ name : alloy-varnish-log-config
152+ items :
153+ - key : config.alloy
154+ path : config.alloy
93155 affinity :
94156 podAntiAffinity :
95157 requiredDuringSchedulingIgnoredDuringExecution :
0 commit comments