Skip to content

Commit

Permalink
Remove scale from zero for machinepools
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Aug 23, 2024
1 parent 3cb5632 commit 5189c7a
Showing 1 changed file with 1 addition and 45 deletions.
46 changes: 1 addition & 45 deletions test/e2e/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type AutoscalerSpecInput struct {
InstallOnManagementCluster bool

// ScaleToAndFromZero enables tests to scale to and from zero.
// Note: This is only implemented for MachineDeployments.
ScaleToAndFromZero bool

// Allows to inject a function to be run after test namespace is created.
Expand Down Expand Up @@ -360,51 +361,6 @@ func AutoscalerSpec(ctx context.Context, inputGetter func() AutoscalerSpecInput)
Replicas: mpScaledUpReplicas,
WaitForMachinePool: input.E2EConfig.GetIntervals(specName, "wait-controllers"),
})

if input.ScaleToAndFromZero {
By("Enabling autoscaler for the MachinePool to zero")
// Enable autoscaler on the MachinePool.
framework.EnableAutoscalerForMachinePoolTopologyAndWait(ctx, framework.EnableAutoscalerForMachinePoolTopologyAndWaitInput{
ClusterProxy: input.BootstrapClusterProxy,
Cluster: clusterResources.Cluster,
NodeGroupMinSize: "0",
NodeGroupMaxSize: mpNodeGroupMaxSize,
WaitForAnnotationsToBeAdded: input.E2EConfig.GetIntervals(specName, "wait-autoscaler"),
})

// We can savely assume that mdReplicas is 1.
var mdReplicas int32 = 1

By("Scaling the MachinePool scale up deployment to 1")
framework.ScaleScaleUpDeploymentAndWait(ctx, framework.ScaleScaleUpDeploymentAndWaitInput{
ClusterProxy: workloadClusterProxy,
// Set replicas to 1, because we still have 1 Machine from MachineDeployments.
Replicas: 1,
}, input.E2EConfig.GetIntervals(specName, "wait-autoscaler")...)

By("Checking the MachinePool finished scaling down to zero")
framework.AssertMachinePoolReplicas(ctx, framework.AssertMachinePoolReplicasInput{
Getter: input.BootstrapClusterProxy.GetClient(),
MachinePool: clusterResources.MachinePools[0],
Replicas: mdReplicas,
WaitForMachinePool: input.E2EConfig.GetIntervals(specName, "wait-controllers"),
})

By("Scaling the MachinePool scale up deployment to 2")
framework.ScaleScaleUpDeploymentAndWait(ctx, framework.ScaleScaleUpDeploymentAndWaitInput{
ClusterProxy: workloadClusterProxy,
// Set replicas to 2, because we still have 1 Machine from MachineDeployments.
Replicas: mdReplicas + 1,
}, input.E2EConfig.GetIntervals(specName, "wait-autoscaler")...)

By("Checking the MachineDeployment finished scaling up")
framework.AssertMachinePoolReplicas(ctx, framework.AssertMachinePoolReplicasInput{
Getter: input.BootstrapClusterProxy.GetClient(),
MachinePool: clusterResources.MachinePools[0],
Replicas: 1,
WaitForMachinePool: input.E2EConfig.GetIntervals(specName, "wait-controllers"),
})
}
}

By("PASSED!")
Expand Down

0 comments on commit 5189c7a

Please sign in to comment.