Skip to content

Commit 607fa5f

Browse files
authored
Fix Contour e2e (#91)
1 parent 1f0d47f commit 607fa5f

File tree

10 files changed

+81
-4
lines changed

10 files changed

+81
-4
lines changed

.github/actions/kind-create/action.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,12 @@ runs:
4545
chmod 600 $kubeconfig_path
4646
echo "kubeconfig=$(echo $kubeconfig_path)" >> $GITHUB_OUTPUT
4747
shell: bash
48+
49+
- name: Install cloud-provider-kind
50+
id: cloud-provider-kind
51+
run: |
52+
echo "Install cloud-provider-kind"
53+
go install sigs.k8s.io/cloud-provider-kind@latest
54+
kubectl label node e2e-kind-control-plane node.kubernetes.io/exclude-from-external-load-balancers-
55+
~/go/bin/cloud-provider-kind &
56+
shell: bash

.github/workflows/e2e-test.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ jobs:
1818
uses: actions/setup-go@v4
1919
with:
2020
go-version: 1.21
21+
22+
# Enable Tmate Session if you'd like to Debut the E2E Kind Cluster
23+
# - name: Setup tmate session
24+
# uses: mxschmitt/action-tmate@v3
25+
# with:
26+
# detached: true
2127

2228
- name: Checkout code
2329
uses: actions/checkout@v4

.github/workflows/helm.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333

3434
- name: Add Helm repositories
3535
run: |
36-
helm repo add banzaicloud-stable "https://kubernetes-charts.banzaicloud.com"
3736
helm repo add incubator "https://charts.helm.sh/incubator"
3837
helm repo add stable "https://charts.helm.sh/stable"
3938

charts/kafka-operator/templates/operator-rbac.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ rules:
4444
- '*'
4545
verbs:
4646
- '*'
47+
- apiGroups:
48+
- projectcontour.io
49+
resources:
50+
- '*'
51+
verbs:
52+
- '*'
4753
- apiGroups:
4854
- ""
4955
resources:

charts/kafka-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ operator:
2323
# When this field is not empty and Cert-manager is used,
2424
# the Cert-manager's Custom Resource Namespace must be included in the comma separated list.
2525
# When it is empty, all namespaces will be watched.
26-
namespaces: ""
26+
namespaces: "kafka, cert-manager"
2727
verboseLogging: false
2828
developmentLogging: false
2929
resources:

config/samples/simplekafkacluster_ssl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
# sslClientAuth defaults to be "required" for two-way SSL authentication, possible values are: "required", "requested", and "none"
5959
# sslClientAuth: "requested"
6060
sslSecrets:
61-
tlsSecretName: "kafka-ca-certs"
61+
tlsSecretName: "kafka-ca-certificate"
6262
create: true
6363
cruiseControlConfig:
6464
# podSecurityContext:

tests/e2e/const.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const (
4040
testExternalTopicName = "topic-test-external"
4141
testInternalTopicName = "topic-test-internal"
4242

43-
defaultTLSSecretName = "test-secret"
43+
defaultTLSSecretName = "kafka-ca-certificate"
4444
kcatName = "kcat"
4545
zookeeperKind = "zookeeperclusters.zookeeper.pravega.io"
4646
zookeeperClusterName = "zookeeper-server"
@@ -75,6 +75,7 @@ func apiGroupKoperatorDependencies() map[string]string {
7575
"cert-manager": "cert-manager.io",
7676
"zookeeper": "zookeeper.pravega.io",
7777
"prometheus": "monitoring.coreos.com",
78+
"contour": "projectcontour.io",
7879
}
7980
}
8081

tests/e2e/test_uninstall.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,10 @@ func testUninstall() bool {
5757
ConfigPath: kubectlOptions.ConfigPath,
5858
Namespace: certManagerHelmDescriptor.Namespace,
5959
})
60+
requireUninstallingContour(k8s.KubectlOptions{
61+
ContextName: kubectlOptions.ContextName,
62+
ConfigPath: kubectlOptions.ConfigPath,
63+
Namespace: contourIngressControllerHelmDescriptor.Namespace,
64+
})
6065
})
6166
}

tests/e2e/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type dependencyCRDsType struct {
2424
zookeeper []string
2525
prometheus []string
2626
certManager []string
27+
contour []string
2728
}
2829

2930
func (c *dependencyCRDsType) Zookeeper() []string {
@@ -35,13 +36,20 @@ func (c *dependencyCRDsType) Prometheus() []string {
3536
func (c *dependencyCRDsType) CertManager() []string {
3637
return c.certManager
3738
}
39+
func (c *dependencyCRDsType) Contour() []string {
40+
return c.contour
41+
}
3842

3943
func (c *dependencyCRDsType) Initialize(kubectlOptions k8s.KubectlOptions) error {
4044
var err error
4145
c.certManager, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["cert-manager"])
4246
if err != nil {
4347
return fmt.Errorf("initialize Cert-manager CRDs error: %w", err)
4448
}
49+
c.contour, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["contour"])
50+
if err != nil {
51+
return fmt.Errorf("initialize Contour Ingress Controller CRDs error: %w", err)
52+
}
4553
c.prometheus, err = listK8sResourceKinds(kubectlOptions, apiGroupKoperatorDependencies()["prometheus"])
4654
if err != nil {
4755
return fmt.Errorf("initialize Prometheus CRDs error: %w", err)

tests/e2e/uninstall.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,49 @@ func requireRemoveCertManagerCRDs(kubectlOptions k8s.KubectlOptions) {
206206
}
207207
})
208208
}
209+
func requireUninstallingContour(kubectlOptions k8s.KubectlOptions) {
210+
When("Uninstalling zookeeper-operator", func() {
211+
requireUninstallingContourHelmChart(kubectlOptions)
212+
requireRemoveContourCRDs(kubectlOptions)
213+
requireRemoveNamespace(kubectlOptions, contourIngressControllerHelmDescriptor.Namespace)
214+
})
215+
}
216+
217+
// requireUninstallingCertManagerHelmChart uninstalls cert-manager helm chart
218+
// and checks the success of that operation.
219+
func requireUninstallingContourHelmChart(kubectlOptions k8s.KubectlOptions) {
220+
It("Uninstalling Project Contour Helm chart", func() {
221+
err := contourIngressControllerHelmDescriptor.uninstallHelmChart(kubectlOptions, true)
222+
Expect(err).NotTo(HaveOccurred())
223+
224+
By("Verifying Project Contour helm chart resources cleanup")
225+
226+
k8sResourceKinds, err := listK8sResourceKinds(kubectlOptions, "")
227+
Expect(err).ShouldNot(HaveOccurred())
228+
229+
contourAvailableResourceKinds := stringSlicesInstersect(dependencyCRDs.Contour(), k8sResourceKinds)
230+
contourAvailableResourceKinds = append(contourAvailableResourceKinds, basicK8sResourceKinds()...)
231+
232+
remainedResources, err := getK8sResources(kubectlOptions,
233+
contourAvailableResourceKinds,
234+
fmt.Sprintf(managedByHelmLabelTemplate, contourIngressControllerHelmDescriptor.ReleaseName),
235+
"",
236+
kubectlArgGoTemplateKindNameNamespace,
237+
"--all-namespaces")
238+
Expect(err).ShouldNot(HaveOccurred())
239+
240+
Expect(remainedResources).Should(BeEmpty())
241+
})
242+
}
243+
244+
func requireRemoveContourCRDs(kubectlOptions k8s.KubectlOptions) {
245+
It("Removing Contour Ingress Controller CRDs", func() {
246+
for _, crd := range dependencyCRDs.Contour() {
247+
err := deleteK8sResourceNoErrNotFound(kubectlOptions, defaultDeletionTimeout, crdKind, crd)
248+
Expect(err).ShouldNot(HaveOccurred())
249+
}
250+
})
251+
}
209252

210253
// requireRemoveNamespace deletes the indicated namespace object
211254
func requireRemoveNamespace(kubectlOptions k8s.KubectlOptions, namespace string) {

0 commit comments

Comments
 (0)