Skip to content
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

Skip draining managed nodegroups when deleting cluster #7515

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

yuxiang-zhang
Copy link
Member

Description

As pointed out in #4205, the code intended to only drain unmanaged nodegroups since EKS should take care of managed nodegroups. However, cmdutils.ToKubeNodeGroups function has been populating the DrainInput with both unmanaged and managed nodegroups. This causes an inconsistency where when using eksctl delete cluster --config-file with a config that specify the managed nodegroup config, that managed nodegroup get drained; but eksctl delete cluster --name deleting the same cluster will skip draining the same managed nodegroup, because https://github.com/yuxiang-zhang/eksctl/blob/1d9cd7dc8370716d711e45bf17e2967434eb88f4/pkg/actions/cluster/delete.go#L174-L179 only populates the unmanaged nodegroups.

Regardless of using --config-file, the behaviour for deleting a cluster should be consistent: either drain managed nodegroups, or skip draining managed nodegroups. This change sticks with the original intent from #4205, that is to skip draining managed nodegroups.

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the userdocs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes
  • (Core team) Added labels for change area (e.g. area/nodegroup) and kind (e.g. kind/improvement)

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@yuxiang-zhang yuxiang-zhang changed the title Drain unmanaged nodegroups only when deleting cluster Skip draining managed nodegroups when deleting cluster Jan 30, 2024
logger.Info("will drain %d unmanaged nodegroup(s) in cluster %q", len(cfg.NodeGroups), cfg.Metadata.Name)

drainInput := &nodegroup.DrainInput{
NodeGroups: cmdutils.ToKubeNodeGroups(cfg),
NodeGroups: cmdutils.ToKubeNodeGroups(cfg.NodeGroups, []*api.ManagedNodeGroup{}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the function signature for allowing specifying empty list of either unmanaged/managed nodegroups

@yuxiang-zhang yuxiang-zhang merged commit 71d8472 into eksctl-io:main Jan 31, 2024
10 checks passed
@yuxiang-zhang yuxiang-zhang deleted the drain-unmanaged-ng-only branch January 31, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants