Skip to content

Commit

Permalink
Merge pull request #4271 from mboersma/cherry-pick-4255-to-release-1.11
Browse files Browse the repository at this point in the history
[release-1.11] wait for provisioning state in AKS e2e tests
  • Loading branch information
k8s-ci-robot authored Nov 15, 2023
2 parents 8fb7999 + 8db624e commit eec800c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/e2e/aks_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func validateAKSAutoscaleDisabled(agentPoolGetter func() (containerservice.Agent
Eventually(func(g Gomega) {
agentpool, err := agentPoolGetter()
g.Expect(err).NotTo(HaveOccurred())
g.Expect(agentpool.ProvisioningState).To(Equal(ptr.To("Succeeded")))
g.Expect(ptr.Deref(agentpool.EnableAutoScaling, false)).To(BeFalse())
}, inputGetter().WaitIntervals...).Should(Succeed())
}
Expand All @@ -123,6 +124,7 @@ func validateAKSAutoscaleEnabled(agentPoolGetter func() (containerservice.AgentP
Eventually(func(g Gomega) {
agentpool, err := agentPoolGetter()
g.Expect(err).NotTo(HaveOccurred())
g.Expect(agentpool.ProvisioningState).To(Equal(ptr.To("Succeeded")))
g.Expect(ptr.Deref(agentpool.EnableAutoScaling, false)).To(BeTrue())
}, inputGetter().WaitIntervals...).Should(Succeed())
}
2 changes: 2 additions & 0 deletions test/e2e/aks_azure_cluster_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func AKSAzureClusterAutoscalerSettingsSpec(ctx context.Context, inputGetter func

aks, err := containerserviceClient.Get(ctx, amcp.Spec.ResourceGroupName, amcp.Name, nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(aks.Properties.ProvisioningState).To(Equal(ptr.To("Succeeded")))
aksInitialAutoScalerProfile := aks.Properties.AutoScalerProfile

// Conditional is based off of the actual AKS settings not the AzureManagedControlPlane
Expand Down Expand Up @@ -111,6 +112,7 @@ func AKSAzureClusterAutoscalerSettingsSpec(ctx context.Context, inputGetter func
// Check that the autoscaler settings have been sync'd to AKS
aks, err := containerserviceClient.Get(ctx, amcp.Spec.ResourceGroupName, amcp.Name, nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(aks.Properties.ProvisioningState).To(Equal(ptr.To("Succeeded")))
g.Expect(aks.Properties.AutoScalerProfile).ToNot(BeNil())
g.Expect(aks.Properties.AutoScalerProfile.Expander).To(Equal(&expectedAksExpander))
}, input.WaitIntervals...).Should(Succeed())
Expand Down
1 change: 1 addition & 0 deletions test/e2e/aks_node_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func AKSNodeLabelsSpec(ctx context.Context, inputGetter func() AKSNodeLabelsSpec
checkLabels := func(g Gomega) {
agentpool, err := agentpoolsClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name, *ammp.Spec.Name)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(agentpool.ProvisioningState).To(Equal(ptr.To("Succeeded")))

var actualLabels map[string]string
if agentpool.NodeLabels != nil {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/aks_node_taints.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
Expand Down Expand Up @@ -92,6 +93,7 @@ func AKSNodeTaintsSpec(ctx context.Context, inputGetter func() AKSNodeTaintsSpec

agentpool, err := agentpoolsClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name, *ammp.Spec.Name)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(agentpool.ProvisioningState).To(Equal(ptr.To("Succeeded")))
actualTaintStrs := agentpool.NodeTaints
if expectedTaintStrs == nil {
g.Expect(actualTaintStrs).To(BeNil())
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/aks_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
"sigs.k8s.io/cluster-api-provider-azure/azure/converters"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand Down Expand Up @@ -86,6 +87,7 @@ func AKSAdditionalTagsSpec(ctx context.Context, inputGetter func() AKSAdditional
checkTags := func(g Gomega) {
managedcluster, err := managedclustersClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(managedcluster.ProvisioningState).To(Equal(ptr.To("Succeeded")))
actualTags := converters.MapToTags(managedcluster.Tags)
// Ignore tags not originally specified in spec.additionalTags
for k := range nonAdditionalTagKeys {
Expand Down Expand Up @@ -170,6 +172,7 @@ func AKSAdditionalTagsSpec(ctx context.Context, inputGetter func() AKSAdditional
checkTags := func(g Gomega) {
agentpool, err := agentpoolsClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name, *ammp.Spec.Name)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(agentpool.ProvisioningState).To(Equal(ptr.To("Succeeded")))
actualTags := converters.MapToTags(agentpool.Tags)
// Ignore tags not originally specified in spec.additionalTags
for k := range nonAdditionalTagKeys {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/aks_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/Azure/go-autorest/autorest/azure/auth"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/utils/ptr"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
azureutil "sigs.k8s.io/cluster-api-provider-azure/util/azure"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand Down Expand Up @@ -69,6 +70,7 @@ func AKSUpgradeSpec(ctx context.Context, inputGetter func() AKSUpgradeSpecInput)
Eventually(func(g Gomega) {
aksCluster, err := managedClustersClient.Get(ctx, infraControlPlane.Spec.ResourceGroupName, infraControlPlane.Name)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(aksCluster.ProvisioningState).To(Equal(ptr.To("Succeeded")))
g.Expect(aksCluster.ManagedClusterProperties).NotTo(BeNil())
g.Expect(aksCluster.ManagedClusterProperties.KubernetesVersion).NotTo(BeNil())
g.Expect("v" + *aksCluster.KubernetesVersion).To(Equal(input.KubernetesVersionUpgradeTo))
Expand Down

0 comments on commit eec800c

Please sign in to comment.