-
Couldn't load subscription status.
- Fork 636
✨ feat: Implement autoscaling from zero by auto-populating AWSMachineTemplate capacity #5711
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?
✨ feat: Implement autoscaling from zero by auto-populating AWSMachineTemplate capacity #5711
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @LiangquanLi930. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
50f8188 to
f1ee365
Compare
|
/test pull-cluster-api-provider-aws-e2e-blocking |
f1ee365 to
3be8f4d
Compare
01be987 to
915f55b
Compare
915f55b to
b3850d1
Compare
| clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
| ) | ||
|
|
||
| func TestAWSMachineTemplateReconciler(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could there also be a unit test which expects actual correct values instead of just checking "capacity" is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also add the nodeInfo information as described in https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md ?
|
that said, |
|
/test pull-cluster-api-provider-aws-e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general this is looking good to me, i tend to agree with Christian's questions.
|
/test pull-cluster-api-provider-aws-e2e |
679c53a to
3208d4c
Compare
|
/test pull-cluster-api-provider-aws-e2e |
f02a539 to
cee9b2e
Compare
|
/test pull-cluster-api-provider-aws-test |
d87e524 to
ae396bf
Compare
ae396bf to
15d3232
Compare
|
/test pull-cluster-api-provider-aws-e2e |
|
@LiangquanLi930: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
| // Extract node info from AMI if available | ||
| nodeInfo := &infrav1.NodeInfo{} | ||
| amiID := template.Spec.Template.Spec.AMI.ID | ||
| if amiID != nil && *amiID != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elmiko @chrischdi Hi
I have a question: when an AWSMachineTemplate does not specify an AMI.ID, how should this be handled? Should we keep it as it is, or should we retrieve the AMI.ID in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or in other words, do we have any other ways to obtain the architecture and OS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what we do when there's no AMI ID defined for a Machine: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/pkg/cloud/services/ec2/instances.go#L144
I would say we could probably re-use https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/pkg/cloud/services/ec2/ami.go#L174, and if that doesn't get what we need, it's an error and the user needs to give us either the AMI ID or some of the other lookup data.
| } | ||
|
|
||
| // Determine OS - check Platform field first (specifically for Windows identification) | ||
| var os string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could initialize this with linux and only change to windows if the image.Platform or the image.PlatformDetails say it's windows? A fairly minor change, but it would eliminate the check at L242.
| // Extract node info from AMI if available | ||
| nodeInfo := &infrav1.NodeInfo{} | ||
| amiID := template.Spec.Template.Spec.AMI.ID | ||
| if amiID != nil && *amiID != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what we do when there's no AMI ID defined for a Machine: https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/pkg/cloud/services/ec2/instances.go#L144
I would say we could probably re-use https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/pkg/cloud/services/ec2/ami.go#L174, and if that doesn't get what we need, it's an error and the user needs to give us either the AMI ID or some of the other lookup data.
✨ Implement autoscaling from zero by auto-populating AWSMachineTemplate capacity
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR implements the Cluster API autoscaling from zero proposal for CAPA by adding a controller that automatically populates
AWSMachineTemplate.Status.Capacitywith instance type information.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Checklist:
Release note: