From feb3a290ee90b45e7a1454668fab0a6c1278c852 Mon Sep 17 00:00:00 2001 From: willie-yao Date: Tue, 26 Sep 2023 20:04:17 +0000 Subject: [PATCH] Add inital e2e test --- test/e2e/azure_test.go | 120 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/test/e2e/azure_test.go b/test/e2e/azure_test.go index bce4c0f8bb59..7dd6ceb24ea6 100644 --- a/test/e2e/azure_test.go +++ b/test/e2e/azure_test.go @@ -842,6 +842,126 @@ var _ = Describe("Workload cluster creation", func() { }) }) + Context("Creating an AKS cluster using ClusterClass [Managed Kubernetes]", func() { + It("with a single control plane node and 1 node", func() { + clusterName = getClusterName(clusterNamePrefix, aksClusterNameSuffix) + kubernetesVersionUpgradeFrom, err := GetAKSKubernetesVersion(ctx, e2eConfig, AKSKubernetesVersionUpgradeFrom) + Expect(err).To(BeNil()) + kubernetesVersion, err := GetAKSKubernetesVersion(ctx, e2eConfig, AKSKubernetesVersion) + Expect(err).To(BeNil()) + + clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput( + specName, + withFlavor("aks-clusterclass"), + withNamespace(namespace.Name), + withClusterName(clusterName), + withKubernetesVersion(kubernetesVersionUpgradeFrom), + withControlPlaneMachineCount(1), + withWorkerMachineCount(1), + withMachineDeploymentInterval(specName, ""), + withMachinePoolInterval(specName, "wait-worker-nodes"), + withControlPlaneWaiters(clusterctl.ControlPlaneWaiters{ + WaitForControlPlaneInitialized: WaitForAKSControlPlaneInitialized, + WaitForControlPlaneMachinesReady: WaitForAKSControlPlaneReady, + }), + ), result) + + By("Upgrading the Kubernetes version of the cluster", func() { + AKSUpgradeSpec(ctx, func() AKSUpgradeSpecInput { + return AKSUpgradeSpecInput{ + Cluster: result.Cluster, + MachinePools: result.MachinePools, + KubernetesVersionUpgradeTo: kubernetesVersion, + WaitForControlPlane: e2eConfig.GetIntervals(specName, "wait-machine-upgrade"), + WaitForMachinePools: e2eConfig.GetIntervals(specName, "wait-machine-pool-upgrade"), + } + }) + }) + + By("Exercising machine pools", func() { + AKSMachinePoolSpec(ctx, func() AKSMachinePoolSpecInput { + return AKSMachinePoolSpecInput{ + Cluster: result.Cluster, + MachinePools: result.MachinePools, + WaitIntervals: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"), + } + }) + }) + + By("creating a machine pool with public IP addresses from a prefix", func() { + // This test is also currently serving as the canonical + // "create/delete node pool" test. Eventually, that should be + // made more distinct from this public IP prefix test. + AKSPublicIPPrefixSpec(ctx, func() AKSPublicIPPrefixSpecInput { + return AKSPublicIPPrefixSpecInput{ + Cluster: result.Cluster, + KubernetesVersion: kubernetesVersion, + WaitIntervals: e2eConfig.GetIntervals(specName, "wait-worker-nodes"), + } + }) + }) + + By("creating a machine pool with spot max price and scale down mode", func() { + AKSSpotSpec(ctx, func() AKSSpotSpecInput { + return AKSSpotSpecInput{ + Cluster: result.Cluster, + KubernetesVersion: kubernetesVersion, + WaitIntervals: e2eConfig.GetIntervals(specName, "wait-worker-nodes"), + } + }) + }) + + By("modifying nodepool autoscaling configuration", func() { + AKSAutoscaleSpec(ctx, func() AKSAutoscaleSpecInput { + return AKSAutoscaleSpecInput{ + Cluster: result.Cluster, + MachinePool: result.MachinePools[0], + WaitIntervals: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"), + } + }) + }) + + By("modifying additionalTags configuration", func() { + AKSAdditionalTagsSpec(ctx, func() AKSAdditionalTagsSpecInput { + return AKSAdditionalTagsSpecInput{ + Cluster: result.Cluster, + MachinePools: result.MachinePools, + WaitForUpdate: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"), + } + }) + }) + + By("modifying the azure cluster-autoscaler settings", func() { + AKSAzureClusterAutoscalerSettingsSpec(ctx, func() AKSAzureClusterAutoscalerSettingsSpecInput { + return AKSAzureClusterAutoscalerSettingsSpecInput{ + Cluster: result.Cluster, + WaitIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"), + } + }) + }) + + By("modifying node labels configuration", func() { + AKSNodeLabelsSpec(ctx, func() AKSNodeLabelsSpecInput { + return AKSNodeLabelsSpecInput{ + Cluster: result.Cluster, + MachinePools: result.MachinePools, + WaitForUpdate: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"), + } + }) + }) + + By("modifying taints configuration", func() { + AKSNodeTaintsSpec(ctx, func() AKSNodeTaintsSpecInput { + return AKSNodeTaintsSpecInput{ + Cluster: result.Cluster, + MachinePools: result.MachinePools, + WaitForUpdate: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"), + } + }) + }) + }) + }) + // ci-e2e.sh and Prow CI skip this test by default. To include this test, set `GINKGO_SKIP=""`. // This spec expects a user-assigned identity named "cloud-provider-user-identity" in a "capz-ci" // resource group. Override these defaults by setting the USER_IDENTITY and CI_RG environment variables.