Skip to content

Commit 1636804

Browse files
committed
Bump cluster-autoscaler to v1.33, adjust RBAC, pin apiVersion to v1beta1
Signed-off-by: Stefan Büringer buringerst@vmware.com
1 parent 7b5d4b0 commit 1636804

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

test/e2e/autoscaler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var _ = Describe("When using the autoscaler with Cluster API using ClusterClass
3636
InfrastructureMachinePoolTemplateKind: "dockermachinepooltemplates",
3737
InfrastructureMachinePoolKind: "dockermachinepools",
3838
Flavor: ptr.To("topology-autoscaler"),
39-
AutoscalerVersion: "v1.31.1",
39+
AutoscalerVersion: "v1.33.0",
4040
}
4141
})
4242
})

test/e2e/data/autoscaler/autoscaler-to-workload-workload.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ rules:
7676
- get
7777
- list
7878
- watch
79+
- apiGroups:
80+
- "storage.k8s.io"
81+
resources:
82+
- volumeattachments
83+
verbs:
84+
- get
85+
- list
86+
- watch
7987
- apiGroups:
8088
- ""
8189
resources:
@@ -190,6 +198,12 @@ spec:
190198
# Note: The E2E test should only go up to 4 (assuming it starts with a min node group size of 2).
191199
# Using 6 for additional some buffer and to allow different starting min node group sizes.
192200
- --max-nodes-total=6
201+
env:
202+
# Per default autoscaler uses the preferred apiVersion to retrieve MachineDeployments.
203+
# If that apiVersion is v1beta2 the current autoscaler implementation is not able
204+
# to resolve infrastructureRefs as the ref format changed. This would break scale from zero.
205+
- name: CAPI_VERSION
206+
value: v1beta1
193207
volumeMounts:
194208
- name: kubeconfig-management-cluster
195209
mountPath: /management-cluster

test/framework/autoscaler_helpers.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,21 +542,31 @@ func getAuthenticationTokenForAutoscaler(ctx context.Context, managementClusterP
542542
}
543543
Expect(managementClusterProxy.GetClient().Create(ctx, sa)).To(Succeed(), fmt.Sprintf("failed to create %s service account", name))
544544

545+
var resources []string
546+
if infraMachineTemplateKind != "" {
547+
resources = append(resources, infraMachineTemplateKind)
548+
}
549+
if infraMachinePoolTemplateKind != "" {
550+
resources = append(resources, infraMachinePoolTemplateKind)
551+
}
552+
if infraMachinePoolKind != "" {
553+
resources = append(resources, infraMachinePoolKind)
554+
}
545555
role := &rbacv1.Role{
546556
ObjectMeta: metav1.ObjectMeta{
547557
Name: name,
548558
Namespace: namespace,
549559
},
550560
Rules: []rbacv1.PolicyRule{
551561
{
552-
Verbs: []string{"get", "list", "update", "watch"},
562+
Verbs: []string{"get", "list", "watch", "patch", "update"},
553563
APIGroups: []string{"cluster.x-k8s.io"},
554564
Resources: []string{"machinedeployments", "machinedeployments/scale", "machinepools", "machinepools/scale", "machines", "machinesets"},
555565
},
556566
{
557-
Verbs: []string{"get", "list"},
567+
Verbs: []string{"get", "list", "watch"},
558568
APIGroups: []string{infraAPIGroup},
559-
Resources: []string{infraMachineTemplateKind, infraMachinePoolTemplateKind, infraMachinePoolKind},
569+
Resources: resources,
560570
},
561571
},
562572
}

0 commit comments

Comments
 (0)