diff --git a/.github/actions/kind-create/action.yaml b/.github/actions/kind-create/action.yaml index 52e0ddeba..00581be78 100644 --- a/.github/actions/kind-create/action.yaml +++ b/.github/actions/kind-create/action.yaml @@ -45,3 +45,12 @@ runs: chmod 600 $kubeconfig_path echo "kubeconfig=$(echo $kubeconfig_path)" >> $GITHUB_OUTPUT shell: bash + + - name: Install cloud-provider-kind + id: cloud-provider-kind + run: | + echo "Install cloud-provider-kind" + go install sigs.k8s.io/cloud-provider-kind@latest + kubectl label node e2e-kind-control-plane node.kubernetes.io/exclude-from-external-load-balancers- + ~/go/bin/cloud-provider-kind & + shell: bash diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 3d9b0602f..f0eb0e71f 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -18,6 +18,12 @@ jobs: uses: actions/setup-go@v4 with: go-version: 1.21 + + # Enable Tmate Session if you'd like to Debut the E2E Kind Cluster + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + # with: + # detached: true - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml index f2d49110c..617586969 100644 --- a/.github/workflows/helm.yml +++ b/.github/workflows/helm.yml @@ -33,7 +33,6 @@ jobs: - name: Add Helm repositories run: | - helm repo add banzaicloud-stable "https://kubernetes-charts.banzaicloud.com" helm repo add incubator "https://charts.helm.sh/incubator" helm repo add stable "https://charts.helm.sh/stable" diff --git a/charts/kafka-operator/templates/operator-rbac.yaml b/charts/kafka-operator/templates/operator-rbac.yaml index 29557e617..5c47bcc80 100644 --- a/charts/kafka-operator/templates/operator-rbac.yaml +++ b/charts/kafka-operator/templates/operator-rbac.yaml @@ -44,6 +44,12 @@ rules: - '*' verbs: - '*' +- apiGroups: + - projectcontour.io + resources: + - '*' + verbs: + - '*' - apiGroups: - "" resources: diff --git a/charts/kafka-operator/values.yaml b/charts/kafka-operator/values.yaml index a01c18585..fdb940e6e 100644 --- a/charts/kafka-operator/values.yaml +++ b/charts/kafka-operator/values.yaml @@ -23,7 +23,7 @@ operator: # When this field is not empty and Cert-manager is used, # the Cert-manager's Custom Resource Namespace must be included in the comma separated list. # When it is empty, all namespaces will be watched. - namespaces: "" + namespaces: "kafka, cert-manager" verboseLogging: false developmentLogging: false resources: diff --git a/config/samples/simplekafkacluster_ssl.yaml b/config/samples/simplekafkacluster_ssl.yaml index 625b697ec..d39639927 100644 --- a/config/samples/simplekafkacluster_ssl.yaml +++ b/config/samples/simplekafkacluster_ssl.yaml @@ -58,7 +58,7 @@ spec: # sslClientAuth defaults to be "required" for two-way SSL authentication, possible values are: "required", "requested", and "none" # sslClientAuth: "requested" sslSecrets: - tlsSecretName: "kafka-ca-certs" + tlsSecretName: "kafka-ca-certificate" create: true cruiseControlConfig: # podSecurityContext: diff --git a/tests/e2e/const.go b/tests/e2e/const.go index ab9888543..20bb6d984 100644 --- a/tests/e2e/const.go +++ b/tests/e2e/const.go @@ -40,7 +40,7 @@ const ( testExternalTopicName = "topic-test-external" testInternalTopicName = "topic-test-internal" - defaultTLSSecretName = "test-secret" + defaultTLSSecretName = "kafka-ca-certificate" kcatName = "kcat" zookeeperKind = "zookeeperclusters.zookeeper.pravega.io" zookeeperClusterName = "zookeeper-server" @@ -75,6 +75,7 @@ func apiGroupKoperatorDependencies() map[string]string { "cert-manager": "cert-manager.io", "zookeeper": "zookeeper.pravega.io", "prometheus": "monitoring.coreos.com", + "contour": "projectcontour.io", } } diff --git a/tests/e2e/test_uninstall.go b/tests/e2e/test_uninstall.go index 71f12de9e..ad3ca7516 100644 --- a/tests/e2e/test_uninstall.go +++ b/tests/e2e/test_uninstall.go @@ -57,5 +57,10 @@ func testUninstall() bool { ConfigPath: kubectlOptions.ConfigPath, Namespace: certManagerHelmDescriptor.Namespace, }) + requireUninstallingContour(k8s.KubectlOptions{ + ContextName: kubectlOptions.ContextName, + ConfigPath: kubectlOptions.ConfigPath, + Namespace: contourIngressControllerHelmDescriptor.Namespace, + }) }) } diff --git a/tests/e2e/types.go b/tests/e2e/types.go index 31565e1ec..6d64ef7e5 100644 --- a/tests/e2e/types.go +++ b/tests/e2e/types.go @@ -24,6 +24,7 @@ type dependencyCRDsType struct { zookeeper []string prometheus []string certManager []string + contour []string } func (c *dependencyCRDsType) Zookeeper() []string { @@ -35,6 +36,9 @@ func (c *dependencyCRDsType) Prometheus() []string { func (c *dependencyCRDsType) CertManager() []string { return c.certManager } +func (c *dependencyCRDsType) Contour() []string { + return c.contour +} func (c *dependencyCRDsType) Initialize(kubectlOptions k8s.KubectlOptions) error { var err error @@ -42,6 +46,10 @@ func (c *dependencyCRDsType) Initialize(kubectlOptions k8s.KubectlOptions) error if err != nil { return fmt.Errorf("initialize Cert-manager CRDs error: %w", err) } + c.contour, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["contour"]) + if err != nil { + return fmt.Errorf("initialize Contour Ingress Controller CRDs error: %w", err) + } c.prometheus, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["prometheus"]) if err != nil { return fmt.Errorf("initialize Prometheus CRDs error: %w", err) diff --git a/tests/e2e/uninstall.go b/tests/e2e/uninstall.go index fccaff087..f41b338ff 100644 --- a/tests/e2e/uninstall.go +++ b/tests/e2e/uninstall.go @@ -206,6 +206,49 @@ func requireRemoveCertManagerCRDs(kubectlOptions k8s.KubectlOptions) { } }) } +func requireUninstallingContour(kubectlOptions k8s.KubectlOptions) { + When("Uninstalling zookeeper-operator", func() { + requireUninstallingContourHelmChart(kubectlOptions) + requireRemoveContourCRDs(kubectlOptions) + requireRemoveNamespace(kubectlOptions, contourIngressControllerHelmDescriptor.Namespace) + }) +} + +// requireUninstallingCertManagerHelmChart uninstalls cert-manager helm chart +// and checks the success of that operation. +func requireUninstallingContourHelmChart(kubectlOptions k8s.KubectlOptions) { + It("Uninstalling Project Contour Helm chart", func() { + err := contourIngressControllerHelmDescriptor.uninstallHelmChart(kubectlOptions, true) + Expect(err).NotTo(HaveOccurred()) + + By("Verifying Project Contour helm chart resources cleanup") + + k8sResourceKinds, err := listK8sResourceKinds(kubectlOptions, "") + Expect(err).ShouldNot(HaveOccurred()) + + contourAvailableResourceKinds := stringSlicesInstersect(dependencyCRDs.Contour(), k8sResourceKinds) + contourAvailableResourceKinds = append(contourAvailableResourceKinds, basicK8sResourceKinds()...) + + remainedResources, err := getK8sResources(kubectlOptions, + contourAvailableResourceKinds, + fmt.Sprintf(managedByHelmLabelTemplate, contourIngressControllerHelmDescriptor.ReleaseName), + "", + kubectlArgGoTemplateKindNameNamespace, + "--all-namespaces") + Expect(err).ShouldNot(HaveOccurred()) + + Expect(remainedResources).Should(BeEmpty()) + }) +} + +func requireRemoveContourCRDs(kubectlOptions k8s.KubectlOptions) { + It("Removing Contour Ingress Controller CRDs", func() { + for _, crd := range dependencyCRDs.Contour() { + err := deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, crdKind, crd) + Expect(err).ShouldNot(HaveOccurred()) + } + }) +} // requireRemoveNamespace deletes the indicated namespace object func requireRemoveNamespace(kubectlOptions k8s.KubectlOptions, namespace string) {