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

✨ Enable ClusterClass rebase operation #5644

Conversation

killianmuldoon
Copy link
Contributor

@killianmuldoon killianmuldoon commented Nov 11, 2021

This change removes a check in the Cluster Webhook which ensure a cluster can't be moved from one ClusterClass to another. Additional compatibility checks have been added to ensure that the resulting update to the Cluster is protected from some unreconcilable changes as outlined in the clusterClass proposal #4985

Fixes #5318

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 11, 2021
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 11, 2021
@killianmuldoon killianmuldoon force-pushed the webhook/add-cluster-webhook-checks branch 4 times, most recently from 58116fe to 8f9f3a4 Compare November 11, 2021 18:12
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

I like the direction in which this is going :)

A few nits for now. I'll take a closer look later on, but would be good to get the underlying PR merged.

controllers/topology/blueprint_test.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
webhooks/cluster.go Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 16, 2021
@killianmuldoon killianmuldoon force-pushed the webhook/add-cluster-webhook-checks branch from 8f9f3a4 to 04f4be8 Compare November 16, 2021 15:13
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 16, 2021
@killianmuldoon killianmuldoon changed the title ✨ [WIP] Enable ClusterClass rebase operation ✨ Enable ClusterClass rebase operation Nov 16, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 16, 2021
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

@killianmuldoon Can you please rebase the PR on top of main?

I'll do another review then.

controllers/topology/cluster_controller_test.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility_test.go Outdated Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
@killianmuldoon killianmuldoon force-pushed the webhook/add-cluster-webhook-checks branch from 04f4be8 to 4ee61d4 Compare November 17, 2021 09:20
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2021
@killianmuldoon
Copy link
Contributor Author

@sbueringer rebased now.

@killianmuldoon killianmuldoon force-pushed the webhook/add-cluster-webhook-checks branch 2 times, most recently from 622a83d to 53d3c26 Compare November 17, 2021 11:33
controllers/topology/blueprint_test.go Show resolved Hide resolved
internal/topology/check/compatibility.go Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
webhooks/cluster.go Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Looks great. Mostly nits from my side. I skipped compatibility_test.go and cluster_test.go. I'll do that on the next round, but there will be at most a few nits in those files.

controllers/topology/blueprint_test.go Show resolved Hide resolved
controllers/topology/cluster_controller_test.go Outdated Show resolved Hide resolved
controllers/topology/cluster_controller_test.go Outdated Show resolved Hide resolved
controllers/topology/cluster_controller_test.go Outdated Show resolved Hide resolved
controllers/topology/cluster_controller_test.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
webhooks/cluster.go Show resolved Hide resolved
webhooks/cluster.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility_test.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility_test.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility_test.go Show resolved Hide resolved
webhooks/cluster_test.go Outdated Show resolved Hide resolved
// On update.
if old != nil {
// Error if the update moves the cluster from Managed to Unmanaged i.e. the managed topology is removed on update.
if old.Spec.Topology != nil && new.Spec.Topology == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check for managed -> unmanaged

webhooks/cluster.go Show resolved Hide resolved
controllers/topology/cluster_controller_test.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Show resolved Hide resolved
internal/topology/check/compatibility.go Outdated Show resolved Hide resolved
internal/topology/check/compatibility.go Show resolved Hide resolved
}

for i, mdc := range clusterClass.Spec.Workers.MachineDeployments {
allErrs = append(allErrs, LocalObjectTemplateIsValid(&mdc.Template.Bootstrap, clusterClass.Namespace, field.NewPath("spec", "workers", "machineDeployments").Index(i).Child("template", "bootstrap"))...)
Copy link
Member

Choose a reason for hiding this comment

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

(I wouldn't change anything in this PR, just realized it now)
Shouldn't the bootstrap template be optional? (based on that it's optional in MDs)

// ConfigRef is a reference to a bootstrap provider-specific resource
// that holds configuration details. The reference is optional to
// allow users/operators to specify Bootstrap.DataSecretName without
// the need of a controller.

Or is that something not supported by ClusterClass?

Copy link
Member

Choose a reason for hiding this comment

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

cc @fabriziopandini Is this something we have to think about / create an issue for?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so.
it is kind of impossible automatically creating clusters without a bootstrap provider, given that it is impractical or impossible to provide bootstrap data secrets at ClusterClass level

Copy link
Member

Choose a reason for hiding this comment

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

Okay sounds good. Pretty relieved that we don't have to support optional BootstrapTemplates

webhooks/cluster.go Outdated Show resolved Hide resolved
webhooks/cluster_test.go Show resolved Hide resolved
webhooks/cluster_test.go Show resolved Hide resolved
webhooks/cluster_test.go Outdated Show resolved Hide resolved
webhooks/cluster_test.go Outdated Show resolved Hide resolved
@fabriziopandini
Copy link
Member

/lgtm
@vincepri PTAL

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2021
@sbueringer
Copy link
Member

Looks great, thx!

lgtm pending squash

@killianmuldoon killianmuldoon force-pushed the webhook/add-cluster-webhook-checks branch from 7937ad9 to 09b577f Compare November 18, 2021 16:49
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2021
@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2021
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
@killianmuldoon killianmuldoon force-pushed the webhook/add-cluster-webhook-checks branch from 09b577f to 2ffa35b Compare November 18, 2021 16:52
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2021
@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2021
@killianmuldoon
Copy link
Contributor Author

@sbueringer sorry for the ping pong over and back! 😄

@sbueringer
Copy link
Member

@sbueringer sorry for the ping pong over and back! 😄

No problem. I was just starting to write a comment about the state you had in between when I saw the new version :)

@fabriziopandini
Copy link
Member

/lgtm

@fabriziopandini
Copy link
Member

/lgtm
/approve
this blocking some work in this area and this week most of the folks in the US are out, so I'm approving to keep the work moving (BTW this already has two lgtm), and then we should probably have a code walkthrough of al cluster/clusterclass validation

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 22, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9b13261 into kubernetes-sigs:main Nov 22, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.1 milestone Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClusterClass rebase
4 participants