Skip to content

Commit

Permalink
fix node registration name
Browse files Browse the repository at this point in the history
  • Loading branch information
CecileRobertMichon committed Oct 16, 2023
1 parent 70629ca commit 9af3153
Showing 1 changed file with 19 additions and 33 deletions.
52 changes: 19 additions & 33 deletions test/e2e/aks_byo_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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")

Check failure on line 149 in test/e2e/aks_byo_node.go

View workflow job for this annotation

GitHub Actions / coverage

commentedOutCode: may want to remove commented-out code (gocritic)
// err := mgmtClient.Delete(ctx, machinePool)
// Expect(err).NotTo(HaveOccurred())

// Eventually(func(g Gomega) {

Check failure on line 153 in test/e2e/aks_byo_node.go

View workflow job for this annotation

GitHub Actions / coverage

commentedOutCode: may want to remove commented-out code (gocritic)
// 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) {

Check failure on line 158 in test/e2e/aks_byo_node.go

View workflow job for this annotation

GitHub Actions / coverage

commentedOutCode: may want to remove commented-out code (gocritic)
// 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) {

Check failure on line 163 in test/e2e/aks_byo_node.go

View workflow job for this annotation

GitHub Actions / coverage

commentedOutCode: may want to remove commented-out code (gocritic)
// 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")
Expand All @@ -187,24 +186,11 @@ 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{}
err := mgmtClient.Get(ctx, client.ObjectKeyFromObject(machinePool), pool)
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
}

0 comments on commit 9af3153

Please sign in to comment.