From 2e0497bbd62adbc79b9fe8c9787fbdc37a132c14 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 27 Feb 2024 09:59:53 +0100 Subject: [PATCH] `icinga-kubernetes`: Test `ClusterRoleBinding` creation --- ...ga-kubernetes_clusterrolebinding_test.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 charts/icinga-stack/tests/icinga-kubernetes_clusterrolebinding_test.yaml diff --git a/charts/icinga-stack/tests/icinga-kubernetes_clusterrolebinding_test.yaml b/charts/icinga-stack/tests/icinga-kubernetes_clusterrolebinding_test.yaml new file mode 100644 index 0000000..4c64eb0 --- /dev/null +++ b/charts/icinga-stack/tests/icinga-kubernetes_clusterrolebinding_test.yaml @@ -0,0 +1,36 @@ +suite: "[Icinga Kubernetes] ClusterRoleBinding creation" +templates: + - ../charts/icinga-kubernetes/templates/clusterrolebinding.yaml +tests: + - it: creates a ClusterRoleBinding if enabled + values: + - required_values.yaml + set: + icinga-kubernetes: + rbac: + create: true + release: + name: my-icinga + asserts: + - containsDocument: + kind: ClusterRoleBinding + apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} + - equal: + path: metadata.name + value: {{ include "icinga-kubernetes.serviceAccountName" . }} + - equal: + path: roleRef.apiGroup + value: rbac.authorization.k8s.io + - equal: + path: roleRef.Kind + value: ClusterRole + - equal: + path: roleRef.name + value: {{ include "common.names.fullname.namespace" . }} + - contains: + path: subjects + content: + kind: ServiceAccount + name: {{ include "icinga-kubernetes.serviceAccountName" . }} + namespace: {{ include "common.names.namespace" . | quote }} +