-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add nodes-min and nodes-max flags in ng scale #2022
Conversation
ff1afdf
to
28710c1
Compare
04647b2
to
36105a3
Compare
@martina-if @cPu1 for your input and review, happy to address any comment you have 👍 |
7f4500f
to
e4d57a3
Compare
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.
I have left some comments, but otherwise LGTM. ✨
Thanks for the great test coverage for your changes.
pkg/cfn/manager/nodegroup.go
Outdated
changed := ng.DesiredCapacity != nil && int64(*ng.DesiredCapacity) != currentCapacity.Int() | ||
changed = changed || (ng.MinSize != nil && (int64(*ng.MinSize) != currentMinSize.Int())) | ||
changed = changed || (ng.MaxSize != nil && (int64(*ng.MaxSize) != currentMaxSize.Int())) | ||
if !changed { |
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.
Alternatively:
hasChanged := func(desiredVal *int, currentVal gjson.Result) bool {
return desiredVal != nil && int64(*desiredVal) != currentVal.Int()
}
changed := hasChanged(ng.DesiredCapacity, currentCapacity) || hasChanged(ng.MaxSize, currentMaxSize) || hasChanged(ng.MinSize, currentMinSize)
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.
oh good one, I like this inline function style 💯
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.
Nice work. LGTM 🎉
Assumption: - nodes flag is mandatory - perform any validation asap and fail fast instead of relying on CF - cluster config file support will not be out of scope for this PR
+ Use inline function to detect changes + Use inline function to update CF stack
Now `--nodes-max` gets set to the same value as `--nodes` by default. Ref: eksctl-io/eksctl#2022 Signed-off-by: Michi Mutsuzaki <[email protected]>
- Create a cluster with `--without-nodegroup` option and create a node group after deploying Cilium. - Change the cluster name to `test-cluster` in the ENI getting started so it can use the same "Create a nodegroup" section as the EKS guide. Ref: eksctl-io/eksctl#2022 Signed-off-by: Michi Mutsuzaki <[email protected]>
- Create a cluster with `--without-nodegroup` option and create a node group after deploying Cilium. - Change the cluster name to `test-cluster` in the ENI getting started so it can use the same "Create a nodegroup" section as the EKS guide. Ref: eksctl-io/eksctl#2022 Signed-off-by: Michi Mutsuzaki <[email protected]>
[ upstream commit 5f1bec8 ] - Create a cluster with `--without-nodegroup` option and create a node group after deploying Cilium. - Change the cluster name to `test-cluster` in the ENI getting started so it can use the same "Create a nodegroup" section as the EKS guide. Ref: eksctl-io/eksctl#2022 Signed-off-by: Michi Mutsuzaki <[email protected]> Signed-off-by: Tobias Klauser <[email protected]>
[ upstream commit 5f1bec8 ] - Create a cluster with `--without-nodegroup` option and create a node group after deploying Cilium. - Change the cluster name to `test-cluster` in the ENI getting started so it can use the same "Create a nodegroup" section as the EKS guide. Ref: eksctl-io/eksctl#2022 Signed-off-by: Michi Mutsuzaki <[email protected]> Signed-off-by: Tobias Klauser <[email protected]>
Description
Fixes #1893
Fixes #809
Approach
I am having below assumptions/scopes while implementing this feature.
--nodes
flag is mandatory flagfail fast
approach i.e. if there is anything wrong with input, just throw error instead of waiting for error from CF.Testing
invalid flag values
no change in current value
some changes with desired node, min or max
desired node is not within current range from CF
Checklist
README.md
, or thesite/content
directory)area/nodegroup
), target version (e.g.version/0.12.0
) and kind (e.g.kind/improvement
)