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

WIP Allow updating the cluster one instance group at a time #16922

Closed
wants to merge 1 commit into from

Conversation

hakman
Copy link
Member

@hakman hakman commented Oct 26, 2024

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 26, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from hakman. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added area/provider/aws Issues or PRs related to aws provider size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 26, 2024
@@ -285,24 +306,75 @@ func RunUpdateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Up
lifecycleOverrideMap[taskName] = lifecycleOverride
}

list, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

Nit: might be nice to split this into a function?

@justinsb
Copy link
Member

justinsb commented Nov 5, 2024

Remind me - I think you said there's a gotcha with this approach @hakman ?

@hakman
Copy link
Member Author

hakman commented Nov 5, 2024

Remind me - I think you said there's a gotcha with this approach @hakman ?

@justinsb If you try to apply the config to a single IG, the KubeletConfig is removed.

@justinsb
Copy link
Member

justinsb commented Nov 6, 2024

Looked at this for a while, and I think I know what is happening!

So the issue is:

// upgradeSpecs ensures that fields are fully populated / defaulted
func (c *ApplyClusterCmd) upgradeSpecs(ctx context.Context, assetBuilder *assets.AssetBuilder) error {

We store the instanceGroup as the user specified it. But there are many computed fields - the so called "full" instanceGroup or cluster spec. upgradeSpecs converts the instanceGroups to populate these fields.

In this PR, we aren't calling upgradeSpecs or the population logic. So these instance groups don't have many fields populated, including (I would guess) the kubelet config.

I suggest that the easy thing to do is to convert FilteredInstanceGroups into a predicate (i.e. func() bool), and then basically filter these out at the last minute. Then we don't need to duplicate the defaulting logic.

@justinsb
Copy link
Member

justinsb commented Nov 8, 2024

Applying a predicate does seem to work ... https://github.com/justinsb/kops/tree/update-cluster-per-ig

The problem is that I don't think we can just do ASGs. Even on AWS, we need to deal with NodeTerminationHandler object. But I think this problem also exists on other clouds, so we need to solve it there also IIUC

@justinsb
Copy link
Member

justinsb commented Nov 8, 2024

I opened another PR #16936 with the filter. I also had to do something similar to what you did - all tasks have access to InstanceGroups (the filtered instance groups) and AllInstanceGroups (unfiltered). The "trick" is that most tasks work with "InstanceGroups" (the filtered), there are just a handful that need to be repointed to work with AllInstanceGroups (e.g. things that need a list of roles)

Likely we'll need a few tweaks for other clouds, but they shouldn't be too big!

@hakman
Copy link
Member Author

hakman commented Nov 9, 2024

I opened another PR #16936 with the filter. I also had to do something similar to what you did - all tasks have access to InstanceGroups (the filtered instance groups) and AllInstanceGroups (unfiltered). The "trick" is that most tasks work with "InstanceGroups" (the filtered), there are just a handful that need to be repointed to work with AllInstanceGroups (e.g. things that need a list of roles)

Likely we'll need a few tweaks for other clouds, but they shouldn't be too big!

Awesome! 🎉

@hakman hakman closed this Nov 9, 2024
@hakman hakman deleted the update-cluster-per-ig branch November 9, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/aws Issues or PRs related to aws provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants