From e4fe8a5b8dcfc11f1ce782e3c69fedd81542c439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= <charled.breteche@gmail.com> Date: Mon, 23 Jan 2023 19:16:37 +0100 Subject: [PATCH] feat: add helm test for reports controller (#6081) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add helm test for reports controller Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --- .../tests/admission-controller-liveness.yaml | 2 +- .../tests/admission-controller-metrics.yaml | 2 +- .../tests/admission-controller-readiness.yaml | 2 +- .../tests/reports-controller-metrics.yaml | 27 +++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 charts/kyverno/templates/tests/reports-controller-metrics.yaml diff --git a/charts/kyverno/templates/tests/admission-controller-liveness.yaml b/charts/kyverno/templates/tests/admission-controller-liveness.yaml index c1ad3bbc4c..aa1fe77997 100644 --- a/charts/kyverno/templates/tests/admission-controller-liveness.yaml +++ b/charts/kyverno/templates/tests/admission-controller-liveness.yaml @@ -22,4 +22,4 @@ spec: command: - /bin/sh - -c - - sleep 20 ; wget -O- -S --no-check-certificate https://{{ template "kyverno.serviceName" . }}:{{ .Values.service.port }}/health/liveness + - sleep 20 ; wget -O- -S --no-check-certificate https://{{ template "kyverno.serviceName" . }}.{{ template "kyverno.namespace" . }}:{{ .Values.service.port }}/health/liveness diff --git a/charts/kyverno/templates/tests/admission-controller-metrics.yaml b/charts/kyverno/templates/tests/admission-controller-metrics.yaml index 9b60124333..2f187cbec7 100644 --- a/charts/kyverno/templates/tests/admission-controller-metrics.yaml +++ b/charts/kyverno/templates/tests/admission-controller-metrics.yaml @@ -23,5 +23,5 @@ spec: command: - /bin/sh - -c - - sleep 20 ; wget -O- -S --no-check-certificate http://{{ template "kyverno.serviceName" . }}-metrics:{{ .Values.metricsService.port }}/metrics + - sleep 20 ; wget -O- -S --no-check-certificate http://{{ template "kyverno.serviceName" . }}-metrics.{{ template "kyverno.namespace" . }}:{{ .Values.metricsService.port }}/metrics {{- end -}} diff --git a/charts/kyverno/templates/tests/admission-controller-readiness.yaml b/charts/kyverno/templates/tests/admission-controller-readiness.yaml index cc652fb859..38e4265a42 100644 --- a/charts/kyverno/templates/tests/admission-controller-readiness.yaml +++ b/charts/kyverno/templates/tests/admission-controller-readiness.yaml @@ -22,4 +22,4 @@ spec: command: - /bin/sh - -c - - sleep 20 ; wget -O- -S --no-check-certificate https://{{ template "kyverno.serviceName" . }}:{{ .Values.service.port }}/health/readiness + - sleep 20 ; wget -O- -S --no-check-certificate https://{{ template "kyverno.serviceName" . }}.{{ template "kyverno.namespace" . }}:{{ .Values.service.port }}/health/readiness diff --git a/charts/kyverno/templates/tests/reports-controller-metrics.yaml b/charts/kyverno/templates/tests/reports-controller-metrics.yaml new file mode 100644 index 0000000000..a0f8f00f36 --- /dev/null +++ b/charts/kyverno/templates/tests/reports-controller-metrics.yaml @@ -0,0 +1,27 @@ +{{- if and .Values.reportsController.enabled .Values.reportsController.metricsService.create -}} +apiVersion: v1 +kind: Pod +metadata: + name: {{ template "kyverno.fullname" . }}-reports-controller-metrics + namespace: {{ template "kyverno.namespace" . }} + labels: + {{- include "kyverno.test.labels" . | nindent 4 }} + annotations: + {{- include "kyverno.test.annotations" . | nindent 4 }} +spec: + restartPolicy: Never + containers: + - name: test + image: {{ template "kyverno.test.image" . }} + imagePullPolicy: {{ template "kyverno.test.imagePullPolicy" . }} + {{- with .Values.test.resources }} + resources: + {{- tpl (toYaml .) $ | nindent 8 }} + {{- end }} + securityContext: + {{- include "kyverno.test.securityContext" . | nindent 8 }} + command: + - /bin/sh + - -c + - sleep 20 ; wget -O- -S --no-check-certificate http://{{ template "kyverno.reports-controller.name" . }}-metrics.{{ template "kyverno.namespace" . }}:{{ .Values.reportsController.metricsService.port }}/metrics +{{- end -}}