Skip to content

Commit

Permalink
fix conflict on azure-cni daemonset in AKS e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
nojnhuh committed Nov 13, 2024
1 parent 8a89dfa commit 9b99382
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
9 changes: 0 additions & 9 deletions test/e2e/aks.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,11 @@ type DiscoverAndWaitForAKSControlPlaneInput struct {
// This will be invoked by cluster api e2e framework.
func WaitForAKSControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, result *clusterctl.ApplyCustomClusterTemplateAndWaitResult) {
client := input.ClusterProxy.GetClient()
cluster := framework.GetClusterByName(ctx, framework.GetClusterByNameInput{
Getter: client,
Name: input.ClusterName,
Namespace: input.Namespace,
})

DiscoverAndWaitForAKSControlPlaneInitialized(ctx, DiscoverAndWaitForAKSControlPlaneInput{
Lister: client,
Getter: client,
Cluster: result.Cluster,
}, input.WaitForControlPlaneIntervals...)
if cluster.Spec.ClusterNetwork != nil && cluster.Spec.ClusterNetwork.Services != nil {
InstallCNIManifest(ctx, input, cluster.Spec.ClusterNetwork.Services.CIDRBlocks, true)
}
}

// WaitForAKSControlPlaneReady waits for the azure managed control plane to be ready.
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ var _ = Describe("Workload cluster creation", func() {
clusterTemplate := createApplyClusterTemplateInput(
specName,
withFlavor("aks"),
withAzureCNIv1Manifest(e2eConfig.GetVariable(AzureCNIv1Manifest)),
withNamespace(namespace.Name),
withClusterName(clusterName),
withKubernetesVersion(kubernetesVersionUpgradeFrom),
Expand Down Expand Up @@ -932,7 +931,6 @@ var _ = Describe("Workload cluster creation", func() {
clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput(
specName,
withFlavor("aks-topology"),
withAzureCNIv1Manifest(e2eConfig.GetVariable(AzureCNIv1Manifest)),
withNamespace(namespace.Name),
withClusterName(clusterName),
withKubernetesVersion(kubernetesVersionUpgradeFrom),
Expand Down
15 changes: 1 addition & 14 deletions test/e2e/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,11 @@ const (

// EnsureCNI installs the CNI plugin depending on the input.CNIManifestPath
func EnsureCNI(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, installHelmChart bool, cidrBlocks []string, hasWindows bool) {
if input.CNIManifestPath != "" {
InstallCNIManifest(ctx, input, cidrBlocks, hasWindows)
} else {
if input.CNIManifestPath == "" {
EnsureCalicoIsReady(ctx, input, installHelmChart, cidrBlocks, hasWindows)
}
}

// InstallCNIManifest installs the CNI manifest provided by the user
func InstallCNIManifest(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, cidrBlocks []string, hasWindows bool) { //nolint:revive // leaving unused cidrBlocks and hasWindows for understanding
By("Installing a CNI plugin to the workload cluster")
workloadCluster := input.ClusterProxy.GetWorkloadCluster(ctx, input.Namespace, input.ClusterName)

cniYaml, err := os.ReadFile(input.CNIManifestPath)
Expect(err).NotTo(HaveOccurred())

Expect(workloadCluster.CreateOrUpdate(ctx, cniYaml)).To(Succeed())
}

// EnsureCalicoIsReady copies the kubeadm configmap to the calico-system namespace and waits for the calico pods to be ready.
func EnsureCalicoIsReady(ctx context.Context, input clusterctl.ApplyCustomClusterTemplateAndWaitInput, installHelmChart bool, cidrBlocks []string, hasWindows bool) {
specName := "ensure-calico"
Expand Down

0 comments on commit 9b99382

Please sign in to comment.