Skip to content

Commit

Permalink
Remove Kind DNS resover override
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderboltsid authored and tuxtof committed Jul 30, 2024
1 parent 30b270d commit 3f1471e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 65 deletions.
28 changes: 0 additions & 28 deletions hack/kind/dns-override.yaml

This file was deleted.

38 changes: 1 addition & 37 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
package e2e

import (
"bytes"
"context"
"fmt"
"os"
"path/filepath"
Expand All @@ -14,12 +12,9 @@ import (

. "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"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/cluster-api/test/framework/bootstrap"
Expand Down Expand Up @@ -69,38 +64,7 @@ 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")
time.Sleep(4 * time.Hour)

By("Initializing the bootstrap cluster")
initBootstrapCluster(bootstrapClusterProxy, e2eConfig, clusterctlConfigPath, artifactFolder)
Expand Down

0 comments on commit 3f1471e

Please sign in to comment.