From 2a6633ba80f7643304ed5bca007f2adf50583f67 Mon Sep 17 00:00:00 2001 From: Ken Crawford Date: Fri, 18 Aug 2023 11:35:53 -0400 Subject: [PATCH] add logging as a sidecar container --- chart/Chart.yaml | 4 ++-- chart/templates/deployment.yaml | 11 +++++++++++ chart/templates/statefulset.yaml | 11 +++++++++++ chart/values.yaml | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 49b39be6..239803a6 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: kube-httpcache description: Varnish on Kubernetes Helm Chart -version: 0.8.0 -appVersion: v0.8.0 +version: 0.8.1 +appVersion: v0.8.1 home: https://varnish-cache.org icon: https://varnish-cache.org/_static/varnish-bunny.png sources: diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 6eebd477..b63dd782 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -125,6 +125,17 @@ spec: resources: {{- toYaml .Values.resources | nindent 12 }} {{- end }} + {{- if .Values.logging.enabled }} + - name: varnishncsa + securityContext: + {{- toYaml .Values.logging.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ "/bin/sh", "-c", "sleep 10 && varnishncsa -F '{{ .Values.logging.logFormat }}'" ] + volumeMounts: + - name: var + mountPath: /var/lib/varnish + {{- end}} {{- if .Values.exporter.enabled }} - name: exporter securityContext: diff --git a/chart/templates/statefulset.yaml b/chart/templates/statefulset.yaml index a851ff56..3f80583c 100644 --- a/chart/templates/statefulset.yaml +++ b/chart/templates/statefulset.yaml @@ -126,6 +126,17 @@ spec: resources: {{- toYaml .Values.resources | nindent 12 }} {{- end }} + {{- if .Values.logging.enabled }} + - name: varnishncsa + securityContext: + {{- toYaml .Values.logging.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ "/bin/sh", "-c", "sleep 10 && varnishncsa -F '{{ .Values.logging.logFormat }}'" ] + volumeMounts: + - name: var + mountPath: /var/lib/varnish + {{- end}} {{- if .Values.exporter.enabled }} - name: exporter securityContext: diff --git a/chart/values.yaml b/chart/values.yaml index 7f3feaf0..fa8c8919 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -64,6 +64,11 @@ serviceAccount: rbac: enabled: true +logging: + enabled: false + logFormat: '%h %U' + securityContext: {} + # create a prometheus operator ServiceMonitor serviceMonitor: enabled: false