Skip to content

Commit

Permalink
Try fix autoscaler test
Browse files Browse the repository at this point in the history
  • Loading branch information
willie-yao committed Oct 4, 2023
1 parent 0d3104f commit b5d161b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/capz/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: localhost:5000/ci-e2e/cluster-api-azure-controller-amd64:20230926200024
- image: gcr.io/k8s-staging-cluster-api-azure/cluster-api-azure-controller:latest
name: manager
2 changes: 1 addition & 1 deletion config/capz/manager_pull_policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: IfNotPresent
imagePullPolicy: Always
2 changes: 1 addition & 1 deletion templates/cluster-template-aks-clusterclass-cluster.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/flavors/aks-clusterclass-cluster/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
cidrBlocks:
- 192.168.0.0/16
topology:
class: default
class: ${CLUSTER_CLASS_NAME}
version: ${KUBERNETES_VERSION}
workers:
machinePools:
Expand Down
1 change: 1 addition & 0 deletions templates/test/ci/prow-aks-clusterclass/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ patchesStrategicMerge:
- patches/tags-aks-clusterclass.yaml
- patches/aks-clusterclass-pool0.yaml
- patches/aks-clusterclass-pool1.yaml
- patches/cluster.yaml
- patches/addons.yaml
- patches.yaml
7 changes: 7 additions & 0 deletions templates/test/ci/prow-aks-clusterclass/patches/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
spec:
topology:
class: default
16 changes: 12 additions & 4 deletions test/e2e/aks_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ import (
)

type AKSAutoscaleSpecInput struct {
Cluster *clusterv1.Cluster
MachinePool *expv1.MachinePool
WaitIntervals []interface{}
Cluster *clusterv1.Cluster
MachinePool *expv1.MachinePool
WaitIntervals []interface{}
isClusterClass bool
}

func AKSAutoscaleSpec(ctx context.Context, inputGetter func() AKSAutoscaleSpecInput) {
Expand All @@ -62,7 +63,14 @@ func AKSAutoscaleSpec(ctx context.Context, inputGetter func() AKSAutoscaleSpecIn
Expect(err).NotTo(HaveOccurred())

ammp := &infrav1.AzureManagedMachinePool{}
err = mgmtClient.Get(ctx, client.ObjectKeyFromObject(input.MachinePool), ammp)
if input.isClusterClass {
err = bootstrapClusterProxy.GetClient().Get(ctx, types.NamespacedName{
Namespace: input.MachinePool.Spec.Template.Spec.InfrastructureRef.Namespace,
Name: input.MachinePool.Spec.Template.Spec.InfrastructureRef.Name,
}, ammp)
} else {
err = mgmtClient.Get(ctx, client.ObjectKeyFromObject(input.MachinePool), ammp)
}
Expect(err).NotTo(HaveOccurred())

resourceGroupName := amcp.Spec.ResourceGroupName
Expand Down

0 comments on commit b5d161b

Please sign in to comment.