From 9af3153311f4af59c6009d4fe2d3f620d8a969a3 Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Mon, 16 Oct 2023 20:02:56 +0000 Subject: [PATCH] fix node registration name --- test/e2e/aks_byo_node.go | 52 +++++++++++++++------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/test/e2e/aks_byo_node.go b/test/e2e/aks_byo_node.go index 039b9a3fbec..b1108dbd06b 100644 --- a/test/e2e/aks_byo_node.go +++ b/test/e2e/aks_byo_node.go @@ -26,7 +26,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" @@ -102,7 +101,7 @@ func AKSBYONodeSpec(ctx context.Context, inputGetter func() AKSBYONodeSpecInput) }, JoinConfiguration: &bootstrapv1.JoinConfiguration{ NodeRegistration: bootstrapv1.NodeRegistrationOptions{ - Name: "{{ ds.meta_data.hostname }}", + Name: "{{ ds.meta_data[\"local_hostname\"] }}", KubeletExtraArgs: map[string]string{ "cloud-provider": "external", "azure-container-registry-config": "/etc/kubernetes/azure.json", @@ -147,24 +146,24 @@ func AKSBYONodeSpec(ctx context.Context, inputGetter func() AKSBYONodeSpecInput) Expect(err).NotTo(HaveOccurred()) defer func() { - By("Deleting the node pool") - err := mgmtClient.Delete(ctx, machinePool) - Expect(err).NotTo(HaveOccurred()) - - Eventually(func(g Gomega) { - err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(machinePool), &expv1.MachinePool{}) - g.Expect(apierrors.IsNotFound(err)).To(BeTrue()) - }, input.WaitIntervals...).Should(Succeed(), "Deleted MachinePool %s/%s still exists", machinePool.Namespace, machinePool.Name) - - Eventually(func(g Gomega) { - err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(infraMachinePool), &infrav1.AzureManagedMachinePool{}) - g.Expect(apierrors.IsNotFound(err)).To(BeTrue()) - }, input.WaitIntervals...).Should(Succeed(), "Deleted AzureManagedMachinePool %s/%s still exists", infraMachinePool.Namespace, infraMachinePool.Name) - - Eventually(func(g Gomega) { - err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(kubeadmConfig), &bootstrapv1.KubeadmConfig{}) - g.Expect(apierrors.IsNotFound(err)).To(BeTrue()) - }, input.WaitIntervals...).Should(Succeed(), "Deleted KubeadmConfig %s/%s still exists", kubeadmConfig.Namespace, kubeadmConfig.Name) + // By("Deleting the node pool") + // err := mgmtClient.Delete(ctx, machinePool) + // Expect(err).NotTo(HaveOccurred()) + + // Eventually(func(g Gomega) { + // err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(machinePool), &expv1.MachinePool{}) + // g.Expect(apierrors.IsNotFound(err)).To(BeTrue()) + // }, input.WaitIntervals...).Should(Succeed(), "Deleted MachinePool %s/%s still exists", machinePool.Namespace, machinePool.Name) + + // Eventually(func(g Gomega) { + // err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(infraMachinePool), &infrav1.AzureManagedMachinePool{}) + // g.Expect(apierrors.IsNotFound(err)).To(BeTrue()) + // }, input.WaitIntervals...).Should(Succeed(), "Deleted AzureManagedMachinePool %s/%s still exists", infraMachinePool.Namespace, infraMachinePool.Name) + + // Eventually(func(g Gomega) { + // err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(kubeadmConfig), &bootstrapv1.KubeadmConfig{}) + // g.Expect(apierrors.IsNotFound(err)).To(BeTrue()) + // }, input.WaitIntervals...).Should(Succeed(), "Deleted KubeadmConfig %s/%s still exists", kubeadmConfig.Namespace, kubeadmConfig.Name) }() By("creating a Kubernetes client to the workload cluster") @@ -187,14 +186,6 @@ func AKSBYONodeSpec(ctx context.Context, inputGetter func() AKSBYONodeSpecInput) } }, input.WaitIntervals...).Should(Succeed()) - // By("Deleting the kubeadm-config configmap") - // // TODO: this is a workaround for Calico Tigera-operator error about missing PodSubnets in the kubeadm-config configmap - // // There might be a better way to do this - // Eventually(func(g Gomega) { - // err := clientset.CoreV1().ConfigMaps("kube-system").Delete(ctx, "kubeadm-config", metav1.DeleteOptions{}) - // g.Expect(err).NotTo(HaveOccurred()) - // }, input.WaitIntervals...).Should(Succeed()) - By("Verifying the MachinePool becomes ready") Eventually(func(g Gomega) { pool := &expv1.MachinePool{} @@ -202,9 +193,4 @@ func AKSBYONodeSpec(ctx context.Context, inputGetter func() AKSBYONodeSpecInput) g.Expect(err).NotTo(HaveOccurred()) g.Expect(conditions.IsTrue(pool, clusterv1.ReadyCondition)).To(BeTrue()) }, input.WaitIntervals...).Should(Succeed()) - - // TODOs: - // - Add kubernetes.azure.com/cluster: MC_cecile-byo-aks-32693_cecile-byo-aks-32693_eastus label to install cloud-provider - // - Install Calico CNI with AKS values.yaml - // - remove kubeadm-config configmap in the cluster or add podSubnet to it }