From a147a905cd95b8f7b50b9970c5f679290e7e5f91 Mon Sep 17 00:00:00 2001 From: Miles-Garnsey Date: Tue, 15 Feb 2022 18:00:09 +1100 Subject: [PATCH] Add new kuttl test on ValidatingWebhookConfiguration to make sure it lands in the right namespace. Add documentation comments to user-defined-ns test to explain what each step is doing w.r.t. namespacing. --- test/kuttl/test-user-defined-ns/01-assert.yaml | 18 +++++++++++++++++- .../01-k8ssandra-operator.yaml | 4 +++- .../02-k8ssandra-cluster.yaml | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/test/kuttl/test-user-defined-ns/01-assert.yaml b/test/kuttl/test-user-defined-ns/01-assert.yaml index 2b7469c80..795c8102d 100644 --- a/test/kuttl/test-user-defined-ns/01-assert.yaml +++ b/test/kuttl/test-user-defined-ns/01-assert.yaml @@ -14,4 +14,20 @@ status: - reason: NewReplicaSetAvailable status: "True" type: Progressing - readyReplicas: 1 \ No newline at end of file + readyReplicas: 1 +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + annotations: + cert-manager.io/inject-ca-from: k8ssandra-operator/cass-operator-serving-cert + name: cass-operator-validating-webhook-configuration +webhooks: + - admissionReviewVersions: + - v1 + - v1beta1 + clientConfig: + service: + name: cass-operator-webhook-service + namespace: k8ssandra-operator + path: /validate-cassandra-datastax-com-v1beta1-cassandradatacenter diff --git a/test/kuttl/test-user-defined-ns/01-k8ssandra-operator.yaml b/test/kuttl/test-user-defined-ns/01-k8ssandra-operator.yaml index 3cd240d91..860a77a6e 100644 --- a/test/kuttl/test-user-defined-ns/01-k8ssandra-operator.yaml +++ b/test/kuttl/test-user-defined-ns/01-k8ssandra-operator.yaml @@ -1,6 +1,8 @@ +# We are deploying a cluster scoped version of cass-operator and k8ssandra-operator into the namespace k8ssandra-operator. +# This sets us up to ensure the cluster-scope component is successful, and immediately demonstrates that the single-namespace component is sucessful. apiVersion: kuttl.dev/v1beta1 kind: TestStep commands: - script: | ../../../bin/kustomize build ../../../config/deployments/control-plane/cluster-scope | kubectl apply --server-side --force-conflicts -f - - ignoreFailure: false \ No newline at end of file + ignoreFailure: false diff --git a/test/kuttl/test-user-defined-ns/02-k8ssandra-cluster.yaml b/test/kuttl/test-user-defined-ns/02-k8ssandra-cluster.yaml index f93c4a305..cfd41e8f5 100644 --- a/test/kuttl/test-user-defined-ns/02-k8ssandra-cluster.yaml +++ b/test/kuttl/test-user-defined-ns/02-k8ssandra-cluster.yaml @@ -1,3 +1,4 @@ +# While all operators are in k8ssandra-operator ns, the K8ssandraCluster is in test-ns. This demonstrates that cluster scoping is successful. apiVersion: kuttl.dev/v1beta1 kind: TestStep commands: