From af3363743d64de1ad5e015d4c32701506f9a2602 Mon Sep 17 00:00:00 2001 From: Scott Leggett Date: Thu, 15 Feb 2024 13:34:29 +0800 Subject: [PATCH] chore: add test case for CDN service annotations --- .../tests/cdn-service-annotations.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 charts/lagoon-logging/templates/tests/cdn-service-annotations.yaml diff --git a/charts/lagoon-logging/templates/tests/cdn-service-annotations.yaml b/charts/lagoon-logging/templates/tests/cdn-service-annotations.yaml new file mode 100644 index 00000000..2cdfc553 --- /dev/null +++ b/charts/lagoon-logging/templates/tests/cdn-service-annotations.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: service-reader +rules: +- apiGroups: [""] # "" indicates the core API group + resources: ["services"] + verbs: ["get", "watch", "list"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: read-services +subjects: +- kind: Group + name: system:serviceaccounts # all serviceaccounts + apiGroup: rbac.authorization.k8s.io +roleRef: + kind: Role + name: service-reader + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "lagoon-logging.logsDispatcher.fullname" . }}-test-cdn-service-annotations + labels: + {{- include "lagoon-logging.logsDispatcher.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: kubectl + image: alpine:latest + command: + - sh + args: + - "-c" + - | + set -eu + apk add --no-cache kubectl jq + kubectl get svc -o json {{ include "lagoon-logging.cdnLogsCollector.fullname" . }} | + jq -e '.metadata.annotations["sh.lagoon.chart.testKey"] == "lagoonTestValue"' + restartPolicy: Never