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 additional validations for clusterclass type #4992

Merged

Conversation

ykakarap
Copy link
Contributor

What this PR does / why we need it:
This PR adds additional validation to the ClusterClass type.

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 #4940

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 22, 2021
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 22, 2021
@ykakarap
Copy link
Contributor Author

/cc @fabriziopandini

@ykakarap
Copy link
Contributor Author

The cyclomatic complexity of the validate function is beyond the linter accepted value. I will move the validation logic into multiple smaller functions.

@ykakarap ykakarap force-pushed the clusterclass_validations branch 3 times, most recently from 28632ee to bee172f Compare July 22, 2021 05:46
@ykakarap ykakarap changed the title 🌱 [WIP] add additional validaitons for clusterclass type 🌱 add additional validaitons for clusterclass type Jul 22, 2021
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook_test.go Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.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.

Probably best to wait until #5000 is merged and then rebase. Otherwise #5000 has to adjust the validation.

api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 27, 2021
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook_test.go Outdated Show resolved Hide resolved
api/v1alpha4/clusterclass_webhook_test.go Show resolved Hide resolved
@sbueringer
Copy link
Member

@ykakarap I think it might be a good idea to resolve the "resolved" conversations above for a better overview

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

+1 to resolve comment already addressed

api/v1alpha4/clusterclass_webhook.go 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.

@ykakarap last one from my side :)

api/v1alpha4/clusterclass_webhook.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

sbueringer commented Jul 28, 2021

@ykakarap Basically lgtm. I'm not sure about the API change. Maybe we have to also leave the constant in sigs.k8s.io/cluster-api/controllers/external and deprecate it. To be honest, sometimes API changes seem to be okay (aka we merged them), but I don't know the policy behind that, yet (apart from the obvious one where we didn't release the previous addition and then it of course wasn't a breaking change)

@fabriziopandini @vincepri WDYT?

@vincepri vincepri changed the title 🌱 add additional validaitons for clusterclass type 🌱 add additional validations for clusterclass type Jul 29, 2021
@vincepri
Copy link
Member

vincepri commented Aug 2, 2021

sigs.k8s.io/cluster-api/controllers/external
  Incompatible changes:
  - TemplateSuffix: removed

This should be kept and deprecated in favor of the new constant

@ykakarap
Copy link
Contributor Author

ykakarap commented Aug 8, 2021

@vincepri @sbueringer Added back TemplateSuffix into sigs.k8s.io/cluster-api/controllers/external with a deprecation notice.

@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 Aug 9, 2021
@fabriziopandini
Copy link
Member

/approve

@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 Aug 9, 2021
@k8s-ci-robot k8s-ci-robot merged commit 92e3867 into kubernetes-sigs:master Aug 9, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Aug 9, 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional validation checks for ClusterClass and managed topologies
5 participants