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

✨ Introduce CEL for ClusterClass Variables #9239

Merged
merged 22 commits into from
Jun 27, 2024

Conversation

chaunceyjiang
Copy link
Contributor

What this PR does / why we need it:

Introduce CEL for ClusterClass Variables.

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 : #8565

/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. labels Aug 18, 2023
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 18, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @chaunceyjiang. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 18, 2023
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2023
@killianmuldoon
Copy link
Contributor

Looks like you'll need to regenerate the associated files

@chaunceyjiang
Copy link
Contributor Author

@killianmuldoon Hello, may I ask if we want to separate the API from its implementation into two PRs or keep them in one PR?

@killianmuldoon
Copy link
Contributor

Hello, may I ask if we want to separate the API from its implementation into two PRs or keep them in one PR?

Best to keep them in the one PR IMO - but maybe keep them to seperate commits. You might want to wait for thorough reviews of the API initially to ensure the implementation doesn't need to be changed regularly.

@k8s-ci-robot
Copy link
Contributor

@chaunceyjiang: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main
  • /test pull-cluster-api-e2e-full-dualstack-and-ipv6-main
  • /test pull-cluster-api-e2e-full-main
  • /test pull-cluster-api-e2e-informing-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-scale-main-experimental
  • /test pull-cluster-api-e2e-workload-upgrade-1-28-latest-main
  • /test pull-cluster-api-test-mink8s-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-informing-main
  • pull-cluster-api-e2e-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test pull-cluster-api-verify-mai

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@chaunceyjiang chaunceyjiang changed the title ✨ [WIP] Introduce CEL for ClusterClass Variables ✨ Introduce CEL for ClusterClass Variables Aug 21, 2023
@chaunceyjiang
Copy link
Contributor Author

@killianmuldoon @sbueringer Hi, The API part is ready for review.

@richardcase
Copy link
Member

I'd also favour the same PR but 2 commits.

@chaunceyjiang - it might be worth marking this as WIP if there will be a second commit with the implementation.

Copy link
Member

@richardcase richardcase left a comment

Choose a reason for hiding this comment

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

This will be really useful 🎉

api/v1beta1/clusterclass_types.go Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Show resolved Hide resolved
@sbueringer
Copy link
Member

sbueringer commented Aug 25, 2023

+1 to just one PR. Just that we don't end up with an API without implementation (assuming the PR doesn't become huge)

Will try to review soon, but my PR backlog is just too big right now

@jimmidyson
Copy link
Member

Excited to see this PR land (with implementation)! @chaunceyjiang Anything I can do to help out?

@chaunceyjiang
Copy link
Contributor Author

@jimmidyson Hi, thank you very much. I am waiting for the API parts review.

Once there is an LGTM, I will start implementing it. Can you help review the API part?

Copy link
Member

@jimmidyson jimmidyson left a comment

Choose a reason for hiding this comment

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

A few comments, but overall looks good to me, nice work. I think there could be some changes once we get to integrating the CEL validation so I also like the idea of implementation as another commit in this PR rather than as a follow-up.

api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Show resolved Hide resolved
api/v1beta1/clusterclass_types.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.

Did a first review, while we probably want to refine the godoc a bit later I think the current state (+ fixes for the findings) is easily good enough to start the implementation. I would focus on implementing the validation functionality for variables.

In a later step / PR we can introduce additional validation in the ClusterClass webhook for the new fields in the ClusterClass

api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Outdated Show resolved Hide resolved
api/v1beta1/common_types.go Outdated Show resolved Hide resolved
api/v1beta1/clusterclass_types.go Show resolved Hide resolved
@jimmidyson
Copy link
Member

@chaunceyjiang Any news on this PR? Great work so far btw!

@chaunceyjiang
Copy link
Contributor Author

@jimmidyson I am very sorry for delaying this PR. In the following time, I will continue to complete this PR.

@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 Jun 24, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 0b5403bd2eea4ce494489fc5cff3315eed8663da

@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-conformance-ci-latest-main
/test pull-cluster-api-e2e-conformance-main
/test pull-cluster-api-e2e-main
/test pull-cluster-api-e2e-mink8s-main
/test pull-cluster-api-e2e-upgrade-1-30-1-31-main

@sbueringer
Copy link
Member

Thx everyone so far, really nice work :)

/assign @chrischdi @fabriziopandini

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 24, 2024

@chaunceyjiang: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main 8834caa link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-mink8s-main

@fabriziopandini
Copy link
Member

@chaunceyjiang @jimmidyson @sbueringer awesome work!
I'm impressed by the quality of the work, detailed comments. top class test coverage, and by the attention to user experience/validation and error messages

/lgtm

@sbueringer sbueringer added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jun 25, 2024
if len(validationErrors) > 0 {
for _, validationError := range validationErrors {
// Add context to the error message.
validationError.Detail = fmt.Sprintf("failed to convert schema definition for variable %q; ClusterClass should be checked: %s", clusterClassVariable.Name, validationError.Detail) // TODO: consider if to add ClusterClass name
Copy link
Member

Choose a reason for hiding this comment

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

Should we resolve this todo or remove it before merging? (Same below)

Copy link
Member

Choose a reason for hiding this comment

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

Nope, it's a copy & paste from a lot of other places (has been there since forever). Let's solve this independently

}

return allErrs
}

// The following funcs are all duplicated from upstream CRD validation at
// https://github.com/kubernetes/apiextensions-apiserver/blob/v0.30.0/pkg/apis/apiextensions/validation/validation.go#L1317.
Copy link
Member

Choose a reason for hiding this comment

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

nit: line number for the link does not seem to be correct :-)

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// https://github.com/kubernetes/apiextensions-apiserver/blob/v0.30.0/pkg/apis/apiextensions/validation/validation.go#L1317.
// https://github.com/kubernetes/apiextensions-apiserver/blob/v0.30.0/pkg/apis/apiextensions/validation/validation.go#L107.

Copy link
Member

Choose a reason for hiding this comment

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

Let's get rid of the line number. These are copied from all over this file

Copy link
Member

Choose a reason for hiding this comment

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

I'll take this as a follow-up. I have a few follow-up PRs queued up anyway

@chrischdi
Copy link
Member

Really awesome work! just two nits from my side, but also okay for me to handle them in a follow-up :-)

@chrischdi
Copy link
Member

/approve

/hold
in case of you want to wait for other reviews

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 27, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrischdi

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 Jun 27, 2024
@sbueringer
Copy link
Member

Thx!

Again, really great work everyone!!

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 27, 2024
@k8s-ci-robot k8s-ci-robot merged commit ada2764 into kubernetes-sigs:main Jun 27, 2024
26 of 27 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone Jun 27, 2024
@jimmidyson
Copy link
Member

Thank you for all the help getting this in, especially to @sbueringer who has been a superstar in reviewing, guiding, and getting improvements/fixes in 🙏

@sbueringer
Copy link
Member

Thx, appreciate it 😃

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. area/clusterclass Issues or PRs related to clusterclass 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants