[EKS] [request]: Managed node group - Automatically updated desiredSize based on minSize or maxSize if needed
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
What do you want us to build?
**Which service(s) is this request for?**
EKS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
When updating a managed node groups scaling configuration through terraform, it is desirable to only update the `minSize` or `maxSize` of the scaling configuration, and leave the `desiredSize` untouched if the EKS cluster has the cluster autoscaler configured. Currently, there is an error when trying to update if the `desiredSize` value is still less than the updated `minSize`, or if the `desiredSize` value is still greater then the updated `maxSize` value (See https://github.com/terraform-aws-modules/terraform-aws-eks/issues/835, and https://github.com/terraform-aws-modules/terraform-aws-eks/issues/1568)
Examples
If the MNG scaling config currently has `minSize=1, desiredSize=1, maxSize=1`
```
aws eks update-nodegroup-config --cluster-name cluster --nodegroup-name nodegroup --scaling-config minSize=2,maxSize=4
```
Errors with `An error occurred (InvalidParameterException) when calling the UpdateNodegroupConfig operation: Minimum capacity 2 can't be greater than desired size 1`
And if the MNG scaling config currently has `minSize=1,desiredSize=2,maxSize=2`
```
aws eks update-nodegroup-config --cluster-name cluster --nodegroup-name nodegroup --scaling-config minSize=1,maxSize=1
```
Errors with `An error occurred (InvalidParameterException) when calling the UpdateNodegroupConfig operation: desired capacity 2 can't be greater than max size 1`
Note that in both the above API calls, the `desiredSize` value is left out of the scaling configuration.
Note the following AutoScaling Group behavior:
```
Note the following about changing DesiredCapacity , MaxSize , or MinSize :
If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.
If you specify a new value for MinSize without specifying a value for DesiredCapacity , and the new MinSize is larger than the current size of the group, this sets the group's DesiredCapacity to the new MinSize value.
If you specify a new value for MaxSize without specifying a value for DesiredCapacity , and the new MaxSize is smaller than the current size of the group, this sets the group's DesiredCapacity to the new MaxSize value.
```
Could the `update-nodegroup-config` API automatically update the desired size similar to how autoscaling groups will update the desired capacity? The terraform aws provider can then omit the desired size field, and allow full management of the scaling config by terraform
**Are you currently working around this issue?**
When updating a managed node group's scaling config, if the desiredSize is still less than minSize, or if the desiredSize is still greater than maxSize, then update the scaling config using an API call, and then update the terraform config. This is not desirable because would like to make all infrastructure changes through terraform
**Additional context**
Anything else we should know?
**Attachments**
If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)
Contributor guide
Research direction
Start with the documented update-nodegroup-config examples and the linked terraform-aws-eks issues 835 and 1568. Compare the requested minSize/maxSize behavior with the stated Auto Scaling Group behavior; done means the API can omit desiredSize while automatically constraining it to the new bounds without the reported validation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, kubernetes, terraform
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100