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

🐛 check if resource exist to allow to create webhooks #1708

Merged

Conversation

camilamacedo86
Copy link
Member

@camilamacedo86 camilamacedo86 commented Oct 5, 2020

Description
Add check to ensure that the resource exists to allow create webhooks and avoid issues such as :

# sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/apis/ship/v1
apis/ship/v1/captain_webhook.go:29:10: undefined: Captain
apis/ship/v1/captain_webhook.go:39:28: undefined: Captain
apis/ship/v1/captain_webhook.go:42:10: undefined: Captain
apis/ship/v1/captain_webhook.go:51:28: undefined: Captain
apis/ship/v1/captain_webhook.go:54:10: undefined: Captain
apis/ship/v1/captain_webhook.go:62:10: undefined: Captain
apis/ship/v1/captain_webhook.go:70:10: undefined: Captain

Motivation
Closes: #1701

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 5, 2020
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 5, 2020
@camilamacedo86 camilamacedo86 requested review from gabbifish and removed request for joelanford October 5, 2020 14:51
Copy link
Contributor

@gabbifish gabbifish left a comment

Choose a reason for hiding this comment

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

/approve

Thank you for this!! I had one tiny nit but it's non-blocking :)

// check if resource exist to create webhook
if !p.config.HasResource(p.resource.GVK()) {
return fmt.Errorf("%s create webhook requires an api with the group,"+
" kind and version informed", p.commandName)
Copy link
Contributor

Choose a reason for hiding this comment

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

would provided be a better term here?

Suggested change
" kind and version informed", p.commandName)
" kind and version provided", p.commandName)

Copy link
Member Author

Choose a reason for hiding this comment

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

done :-)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, gabbifish

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

@gabbifish
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 13, 2020
@gabbifish
Copy link
Contributor

/test pull-kubebuilder-e2e-k8s-1-14-1

@k8s-ci-robot k8s-ci-robot merged commit df80fc5 into kubernetes-sigs:master Oct 13, 2020
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error to create webhook when has no resource for it
3 participants