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

✨ Add validation to nested ObjectMeta fields #8431

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

LuBingtan
Copy link
Contributor

What this PR does / why we need it:
Today we have no validation for nested ObjectMeta fields
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #8231

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 31, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @LuBingtan. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 31, 2023
@LuBingtan LuBingtan force-pushed the add-validation-metadata branch 3 times, most recently from b2a8841 to e32f8f3 Compare March 31, 2023 07:35
@fabriziopandini
Copy link
Member

/ok-to-test

cc @ykakarap @killianmuldoon
It would be great to have unit tests ensuring no regressions for this behavior in all the validation webhooks for the CR with nested ObjectMeta fields

@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 Mar 31, 2023
@LuBingtan
Copy link
Contributor Author

/ok-to-test

cc @ykakarap @killianmuldoon It would be great to have unit tests ensuring no regressions for this behavior in all the validation webhooks for the CR with nested ObjectMeta fields

Sure, I'll add some unit tests

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.

Looks good - I think it might be better to have this function as an internal implementation - but I don't feel too strongly about it.

If it's moved internal it will have to be a standalone function and take clusterv1.ObjectMeta as a parameter.

api/v1beta1/common_validate.go Outdated Show resolved Hide resolved
api/v1beta1/common_validate.go Outdated Show resolved Hide resolved
api/v1beta1/common_validate.go Outdated Show resolved Hide resolved
api/v1beta1/common_validate.go Outdated Show resolved Hide resolved
api/v1beta1/common_validate.go Outdated Show resolved Hide resolved
@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 Apr 5, 2023
@LuBingtan
Copy link
Contributor Author

/retest pull-cluster-api-test-main

@k8s-ci-robot
Copy link
Contributor

@LuBingtan: The /retest command does not accept any targets.
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-test-mink8s-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-main
  • /test pull-cluster-api-e2e-informing-ipv6-main
  • /test pull-cluster-api-e2e-informing-main
  • /test pull-cluster-api-e2e-scale-main-experimental
  • /test pull-cluster-api-e2e-workload-upgrade-1-26-latest-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-ipv6-main
  • pull-cluster-api-e2e-informing-main
  • pull-cluster-api-e2e-main
  • pull-cluster-api-test-main
  • pull-cluster-api-test-mink8s-main
  • pull-cluster-api-verify-main

In response to this:

/retest pull-cluster-api-test-main

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.

@LuBingtan
Copy link
Contributor Author

/retest

@LuBingtan
Copy link
Contributor Author

Hi @killianmuldoon @fabriziopandini
Thanks for your review, it's very helpful to me!
I have made some updates and have addressed most of the comments.
And for some of the comments, I have provided different opinions and replied in the corresponding thread. Please take a look, thanks.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 27, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 10, 2023
Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

From my side:

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 11, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: d2b3869f0f0efd8f546959d74a577f5a1eec1a3f

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 good only minor findings

(sorry for the late review. I think when those two findings are adressed we can merge quickly)

api/v1beta1/common_validate.go Outdated Show resolved Hide resolved
internal/webhooks/clusterclass.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 15, 2023
@LuBingtan
Copy link
Contributor Author

Looks good only minor findings

(sorry for the late review. I think when those two findings are adressed we can merge quickly)

@sbueringer Thanks! Already updated, I believe all comments are addressed. Please take a look again.

@sbueringer
Copy link
Member

Thank you very much!!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 6baf2da8147438dc4e8899f1ddbf7df8cd53236d

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Jul 19, 2023
@k8s-ci-robot k8s-ci-robot merged commit ef27db8 into kubernetes-sigs:main Jul 19, 2023
19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Jul 19, 2023
@g-gaston
Copy link
Contributor

/area api

@k8s-ci-robot k8s-ci-robot added the area/api Issues or PRs related to the APIs label Oct 23, 2023
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/api Issues or PRs related to the APIs 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/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.

Add validation to nested ObjectMeta fields
7 participants