-
Notifications
You must be signed in to change notification settings - Fork 499
CNTRLPLANE-2262: Add Azure scale-from-zero support #8337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
57e21a5
7721908
9bf4e18
9e881ae
d32f2b9
686c55e
ee42ce8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,8 @@ const ( | |
| // and let nodepool, hostedcluster, and client be fields of CAPI / interface methods. | ||
| type CAPI struct { | ||
| *Token | ||
| capiClusterName string | ||
| capiClusterName string | ||
| scaleFromZeroPlatform hyperv1.PlatformType | ||
| upsert.ApplyProvider | ||
| } | ||
|
|
||
|
|
@@ -472,7 +473,7 @@ func (c *CAPI) reconcileMachineDeployment(ctx context.Context, log logr.Logger, | |
| } | ||
| } | ||
|
|
||
| setMachineDeploymentReplicas(nodePool, machineDeployment) | ||
| setMachineDeploymentReplicas(nodePool, machineDeployment, c.scaleFromZeroPlatform) | ||
|
|
||
| if updated := c.propagateVersionAndTemplate(log, machineDeployment, machineTemplateCR); updated { | ||
| return nil | ||
|
|
@@ -756,7 +757,7 @@ func (c *CAPI) reconcileMachineHealthCheck(ctx context.Context, | |
|
|
||
| // setMachineDeploymentReplicas sets wanted replicas: | ||
| // If autoscaling is enabled we reconcile min/max annotations and leave replicas untouched. | ||
| func setMachineDeploymentReplicas(nodePool *hyperv1.NodePool, machineDeployment *capiv1.MachineDeployment) { | ||
| func setMachineDeploymentReplicas(nodePool *hyperv1.NodePool, machineDeployment *capiv1.MachineDeployment, scaleFromZeroPlatform hyperv1.PlatformType) { | ||
| if machineDeployment.Annotations == nil { | ||
| machineDeployment.Annotations = make(map[string]string) | ||
| } | ||
|
|
@@ -773,7 +774,7 @@ func setMachineDeploymentReplicas(nodePool *hyperv1.NodePool, machineDeployment | |
| // NodePools from being permanently stuck at 0 replicas on platforms that don't support | ||
| // scale-from-zero metadata. | ||
| effectiveMin := ptr.Deref(nodePool.Spec.AutoScaling.Min, 0) | ||
| if effectiveMin == 0 && nodePool.Spec.Platform.Type != hyperv1.AWSPlatform { | ||
| if effectiveMin == 0 && nodePool.Spec.Platform.Type != hyperv1.AWSPlatform && nodePool.Spec.Platform.Type != scaleFromZeroPlatform { | ||
| effectiveMin = 1 | ||
| } | ||
|
|
||
|
|
@@ -957,7 +958,7 @@ func (c *CAPI) reconcileMachineSet(ctx context.Context, | |
| } | ||
| machineSet.Spec.Template.Annotations[nodePoolAnnotationTaints] = taintsInJSON | ||
|
|
||
| setMachineSetReplicas(nodePool, machineSet) | ||
| setMachineSetReplicas(nodePool, machineSet, c.scaleFromZeroPlatform) | ||
|
|
||
| isUpdating := false | ||
| // Propagate version and userData Secret to the MachineSet. | ||
|
|
@@ -1064,7 +1065,7 @@ func machineSetInPlaceRolloutIsComplete(machineSet *capiv1.MachineSet) bool { | |
|
|
||
| // setMachineSetReplicas sets wanted replicas: | ||
| // If autoscaling is enabled we reconcile min/max annotations and leave replicas untouched. | ||
| func setMachineSetReplicas(nodePool *hyperv1.NodePool, machineSet *capiv1.MachineSet) { | ||
| func setMachineSetReplicas(nodePool *hyperv1.NodePool, machineSet *capiv1.MachineSet, scaleFromZeroPlatform hyperv1.PlatformType) { | ||
| if machineSet.Annotations == nil { | ||
| machineSet.Annotations = make(map[string]string) | ||
| } | ||
|
|
@@ -1081,7 +1082,7 @@ func setMachineSetReplicas(nodePool *hyperv1.NodePool, machineSet *capiv1.Machin | |
| // NodePools from being permanently stuck at 0 replicas on platforms that don't support | ||
| // scale-from-zero metadata. | ||
| effectiveMin := ptr.Deref(nodePool.Spec.AutoScaling.Min, 0) | ||
| if effectiveMin == 0 && nodePool.Spec.Platform.Type != hyperv1.AWSPlatform { | ||
| if effectiveMin == 0 && nodePool.Spec.Platform.Type != hyperv1.AWSPlatform && nodePool.Spec.Platform.Type != scaleFromZeroPlatform { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to keep nodePool.Spec.Platform.Type != hyperv1.AWSPlatform check here? |
||
| effectiveMin = 1 | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.