From c08d490e8e8c8c6471363a38f6bc35d4321f41d4 Mon Sep 17 00:00:00 2001 From: Sid Shukla Date: Tue, 30 Jul 2024 13:49:07 +0200 Subject: [PATCH] Remove Kind DNS resover override --- hack/kind/dns-override.yaml | 28 ---------------------- test/e2e/e2e_suite_test.go | 48 ++++--------------------------------- 2 files changed, 4 insertions(+), 72 deletions(-) delete mode 100644 hack/kind/dns-override.yaml diff --git a/hack/kind/dns-override.yaml b/hack/kind/dns-override.yaml deleted file mode 100644 index ed3fc3b63..000000000 --- a/hack/kind/dns-override.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2024 Nutanix. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -data: - Corefile: | - .:53 { - errors - health { - lameduck 5s - } - ready - kubernetes cluster.local in-addr.arpa ip6.arpa { - pods insecure - fallthrough in-addr.arpa ip6.arpa - ttl 30 - } - prometheus :9153 - forward . 8.8.8.8 - cache 30 - loop - reload - loadbalance - } -kind: ConfigMap -metadata: - name: coredns - namespace: kube-system diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 77d0a3eab..d7c33a931 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -3,28 +3,21 @@ package e2e import ( - "bytes" - "context" "fmt" - "os" - "path/filepath" - "strings" - "testing" - "time" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" storagev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/yaml" + "os" + "path/filepath" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/bootstrap" "sigs.k8s.io/cluster-api/test/framework/clusterctl" "sigs.k8s.io/cluster-api/test/framework/ginkgoextensions" + "strings" + "testing" ) func TestE2E(t *testing.T) { @@ -69,39 +62,6 @@ var _ = SynchronizedBeforeSuite(func() []byte { By("Setting up the bootstrap cluster") bootstrapClusterProvider, bootstrapClusterProxy = setupBootstrapCluster(e2eConfig, scheme, useExistingCluster) - By("Overriding coreDNS resolver") - // override coredns resolver to 8.8.8.8 and restart coredns deployment - // read the dns-override.yaml file - filePath, _ := filepath.Abs("../../hack/kind/dns-override.yaml") - yamlFile, err := os.ReadFile(filePath) - Expect(err).To(BeNil(), "Failed to read the dns-override.yaml file") - - // decode the yaml file into a Kubernetes object - decode := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(yamlFile), 4096) - configMap := &corev1.ConfigMap{} - err = decode.Decode(&configMap) - Expect(err).To(BeNil(), "Failed to decode the yaml file into a Kubernetes object") - - _, err = bootstrapClusterProxy.GetClientSet(). - CoreV1(). - ConfigMaps(configMap.GetNamespace()). - Update(context.Background(), configMap, metav1.UpdateOptions{}) - Expect( - err, - ).To(BeNil(), "Failed to update the coredns deployment with the dns-override.yaml file") - - timeNow := time.Now().Format(time.RFC3339) - patch := fmt.Sprintf( - `{"spec":{"template":{"metadata":{"annotations":{"kubectl.kubernetes.io/restartedAt":%q}}}}}`, - timeNow, - ) - - _, err = bootstrapClusterProxy.GetClientSet(). - AppsV1(). - Deployments("kube-system"). - Patch(context.Background(), "coredns", types.StrategicMergePatchType, []byte(patch), metav1.PatchOptions{}) - Expect(err).To(BeNil(), "Failed to restart the coredns deployment") - By("Initializing the bootstrap cluster") initBootstrapCluster(bootstrapClusterProxy, e2eConfig, clusterctlConfigPath, artifactFolder)