|
3 | 3 | package e2e
|
4 | 4 |
|
5 | 5 | import (
|
6 |
| - "bytes" |
7 |
| - "context" |
8 | 6 | "fmt"
|
9 |
| - "os" |
10 |
| - "path/filepath" |
11 |
| - "strings" |
12 |
| - "testing" |
13 |
| - "time" |
14 |
| - |
15 | 7 | . "github.com/onsi/ginkgo/v2"
|
16 | 8 | . "github.com/onsi/gomega"
|
17 |
| - corev1 "k8s.io/api/core/v1" |
18 | 9 | storagev1 "k8s.io/api/storage/v1"
|
19 | 10 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
20 | 11 | "k8s.io/apimachinery/pkg/runtime"
|
21 |
| - "k8s.io/apimachinery/pkg/types" |
22 |
| - "k8s.io/apimachinery/pkg/util/yaml" |
| 12 | + "os" |
| 13 | + "path/filepath" |
23 | 14 | clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
|
24 | 15 | "sigs.k8s.io/cluster-api/test/framework"
|
25 | 16 | "sigs.k8s.io/cluster-api/test/framework/bootstrap"
|
26 | 17 | "sigs.k8s.io/cluster-api/test/framework/clusterctl"
|
27 | 18 | "sigs.k8s.io/cluster-api/test/framework/ginkgoextensions"
|
| 19 | + "strings" |
| 20 | + "testing" |
28 | 21 | )
|
29 | 22 |
|
30 | 23 | func TestE2E(t *testing.T) {
|
@@ -69,39 +62,6 @@ var _ = SynchronizedBeforeSuite(func() []byte {
|
69 | 62 | By("Setting up the bootstrap cluster")
|
70 | 63 | bootstrapClusterProvider, bootstrapClusterProxy = setupBootstrapCluster(e2eConfig, scheme, useExistingCluster)
|
71 | 64 |
|
72 |
| - By("Overriding coreDNS resolver") |
73 |
| - // override coredns resolver to 8.8.8.8 and restart coredns deployment |
74 |
| - // read the dns-override.yaml file |
75 |
| - filePath, _ := filepath.Abs("../../hack/kind/dns-override.yaml") |
76 |
| - yamlFile, err := os.ReadFile(filePath) |
77 |
| - Expect(err).To(BeNil(), "Failed to read the dns-override.yaml file") |
78 |
| - |
79 |
| - // decode the yaml file into a Kubernetes object |
80 |
| - decode := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(yamlFile), 4096) |
81 |
| - configMap := &corev1.ConfigMap{} |
82 |
| - err = decode.Decode(&configMap) |
83 |
| - Expect(err).To(BeNil(), "Failed to decode the yaml file into a Kubernetes object") |
84 |
| - |
85 |
| - _, err = bootstrapClusterProxy.GetClientSet(). |
86 |
| - CoreV1(). |
87 |
| - ConfigMaps(configMap.GetNamespace()). |
88 |
| - Update(context.Background(), configMap, metav1.UpdateOptions{}) |
89 |
| - Expect( |
90 |
| - err, |
91 |
| - ).To(BeNil(), "Failed to update the coredns deployment with the dns-override.yaml file") |
92 |
| - |
93 |
| - timeNow := time.Now().Format(time.RFC3339) |
94 |
| - patch := fmt.Sprintf( |
95 |
| - `{"spec":{"template":{"metadata":{"annotations":{"kubectl.kubernetes.io/restartedAt":%q}}}}}`, |
96 |
| - timeNow, |
97 |
| - ) |
98 |
| - |
99 |
| - _, err = bootstrapClusterProxy.GetClientSet(). |
100 |
| - AppsV1(). |
101 |
| - Deployments("kube-system"). |
102 |
| - Patch(context.Background(), "coredns", types.StrategicMergePatchType, []byte(patch), metav1.PatchOptions{}) |
103 |
| - Expect(err).To(BeNil(), "Failed to restart the coredns deployment") |
104 |
| - |
105 | 65 | By("Initializing the bootstrap cluster")
|
106 | 66 | initBootstrapCluster(bootstrapClusterProxy, e2eConfig, clusterctlConfigPath, artifactFolder)
|
107 | 67 |
|
|
0 commit comments