diff --git a/.helm/ecamp3/templates/api_cache_deployment.yaml b/.helm/ecamp3/templates/api_cache_deployment.yaml index 1aabe54a7f..936022dea7 100644 --- a/.helm/ecamp3/templates/api_cache_deployment.yaml +++ b/.helm/ecamp3/templates/api_cache_deployment.yaml @@ -15,6 +15,9 @@ spec: metadata: labels: {{- include "apiCache.selectorLabels" . | nindent 8 }} + annotations: + checksum/vclConfigmap: {{ include (print $.Template.BasePath "/api_cache_vcl_configmap.yaml") . | sha256sum }} + rollme: {{ .Values.imageTag | quote }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -25,7 +28,7 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} enableServiceLinks: false containers: - - name: {{ .Chart.Name }}-api-cache + - name: {{ .Chart.Name }}-api-cache-varnishd securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.apiCache.image.repository }}:{{ .Values.apiCache.image.tag | default .Values.imageTag }}" @@ -54,8 +57,58 @@ spec: volumeMounts: - name: vcl-configmap mountPath: /etc/varnish + - name: vsm + mountPath: /var/lib/varnish + {{- if .Values.apiCache.logging.enabled }} + - name: {{ .Chart.Name }}-api-cache-varnishncsa + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.apiCache.image.repository }}:{{ .Values.apiCache.image.tag | default .Values.imageTag }}" + imagePullPolicy: {{ .Values.apiCache.image.pullPolicy }} + command: + - varnishncsa + {{- if .Values.apiCache.logging.customOutputJsonFormat }} + - -j + {{- end }} + {{- if .Values.apiCache.logging.customOutput }} + - -F + - {{ .Values.apiCache.logging.customOutput | quote }} + {{- end }} + - -t + - {{ .Values.apiCache.logging.timeout | quote }} + resources: + {{- toYaml .Values.apiCache.logging.resources | nindent 12 }} + volumeMounts: + - name: vsm + mountPath: /var/lib/varnish + {{- end }} + {{- if .Values.apiCache.prometheus.enabled }} + - name: {{ .Chart.Name }}-api-cache-prometheus-exporter + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.apiCache.prometheus.image.repository }}:{{ .Values.apiCache.prometheus.image.tag }}" + imagePullPolicy: {{ .Values.apiCache.prometheus.image.pullPolicy }} + ports: + - name: api-cache-metrics + containerPort: {{ .Values.apiCache.prometheus.port }} + protocol: TCP + resources: + {{- toYaml .Values.apiCache.prometheus.resources | nindent 12 }} + command: + - prometheus-varnish-exporter + - -web.telemetry-path + - "{{ .Values.apiCache.prometheus.path }}" + - -web.listen-address + - ":{{ .Values.apiCache.prometheus.port }}" + volumeMounts: + - name: vsm + mountPath: /var/lib/varnish + {{- end }} volumes: - name: vcl-configmap configMap: name: {{ include "apiCache.name" . }}-vcl-configmap + - name: vsm + emptyDir: + medium: Memory {{- end }} \ No newline at end of file diff --git a/.helm/ecamp3/templates/api_cache_service.yaml b/.helm/ecamp3/templates/api_cache_service.yaml index 497b55f4b0..924ed140d0 100644 --- a/.helm/ecamp3/templates/api_cache_service.yaml +++ b/.helm/ecamp3/templates/api_cache_service.yaml @@ -17,6 +17,10 @@ spec: targetPort: api-cache-purge protocol: TCP name: api-cache-purge + - port: {{ .Values.apiCache.prometheus.port }} + targetPort: api-cache-metrics + protocol: TCP + name: api-cache-metrics selector: {{- include "apiCache.selectorLabels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/.helm/ecamp3/values.yaml b/.helm/ecamp3/values.yaml index f25195f096..ac04b9fccb 100644 --- a/.helm/ecamp3/values.yaml +++ b/.helm/ecamp3/values.yaml @@ -240,6 +240,32 @@ apiCache: requests: cpu: 10m memory: 100Mi + logging: + enabled: true + customOutput: null + customOutputJsonFormat: false + # Timeout before returning error on initial VSM connection. + # If set the VSM connection is retried every 0.5 seconds for this many seconds. + # If zero the connection is attempted only once and will fail immediately if unsuccessful. + # If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear. + # Defaults to "off" in this case. + timeout: "off" + resources: + requests: + cpu: 10m + memory: 20Mi + prometheus: + enabled: true + image: + repository: softonic/varnish + tag: 7.2.1 + pullPolicy: IfNotPresent + path: "/metrics" + port: 9131 + resources: + requests: + cpu: 10m + memory: 20Mi autoscaling: enabled: false diff --git a/.ops/observability/prometheus-values-dev.yml b/.ops/observability/prometheus-values-dev.yml index e20b3f6a45..892f22954a 100644 --- a/.ops/observability/prometheus-values-dev.yml +++ b/.ops/observability/prometheus-values-dev.yml @@ -31,6 +31,16 @@ prometheus: - default endpoints: - port: "api-metrics" + - name: "varnish" + selector: + matchLabels: + app.kubernetes.io/instance: ecamp3-dev + app.kubernetes.io/name: ecamp3-api-cache + namespaceSelector: + matchNames: + - default + endpoints: + - port: "api-cache-metrics" prometheusSpec: storageSpec: volumeClaimTemplate: