Skip to content

Conversation

Karthik-K-N
Copy link
Contributor

What this PR does / why we need it:
This PR will contain series of commits to add additional validation for Cluster/ClusterClass webhook for chained upgrades and associated UTs.

More info: #12720 (comment)

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Part of #12720

/area clusterclass

@k8s-ci-robot k8s-ci-robot added area/clusterclass Issues or PRs related to clusterclass cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 1, 2025
@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 assign enxebre for approval. For more information see the 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

@Karthik-K-N
Copy link
Contributor Author

Apologies for delay, back from small vacation, will add other pending changes for clusterclass webhook and UT in following commits.

@sbueringer
Copy link
Member

No problem! Welcome back and thx for working on this!

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 2, 2025
@Karthik-K-N
Copy link
Contributor Author

Added UT for cluster webhook
Added validation for ClusterClass update scenario.
Only thing pending is ClusterClass create case, will take that up if this approach looks good,

PR is ready for initial review.

var allErrs field.ErrorList

// If there is no KubernetesVersions is set in the ClusterClass return early.
if len(newClusterClass.Spec.KubernetesVersions) == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Asking my question regarding this point here

ClusterClass webhook: on create/update: ensure versions of all Clusters using that ClusterClass are included in ClusterClass versions (if CC has versions)

I am bit confused about this check (if CC has versions)*

For example we have a CC A with versions 1.32, 1.33, Then we create new CC B for rebase with no version. Since there are no KubernetesVersion set on CC B, this check makes it as valid.
But in this case what will the Cluster use, will it continue to remain in its version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterclass Issues or PRs related to clusterclass cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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