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

create webhook: return error when used with a core type #2141

Closed
estroz opened this issue Apr 12, 2021 · 18 comments · Fixed by #4210
Closed

create webhook: return error when used with a core type #2141

estroz opened this issue Apr 12, 2021 · 18 comments · Fixed by #4210
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Milestone

Comments

@estroz
Copy link
Contributor

estroz commented Apr 12, 2021

When I run kubebuilder create webhook on a core type, ex. v1.Pod, the command attempts to define methods on a non-existent locally-defined type. Instead, the command should return an error explaining that core types are not supported by this command.

$ go version
go version go1.15.2 linux/amd64
$ kubebuilder version
Version: main.version{KubeBuilderVersion:"v3.0.0-alpha.0-195-g37485126", KubernetesVendor:"unknown", GitCommit:"37485126f95ceb2e92a86497c31f400c8b89f957", BuildDate:"2021-04-12T18:30:56Z", GoOs:"linux", GoArch:"amd64"}
$ cat go.mod | grep controller-runtime
sigs.k8s.io/controller-runtime v0.7.2

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 12, 2021
@camilamacedo86

This comment was marked as outdated.

@estroz

This comment was marked as outdated.

@kopiczko

This comment was marked as outdated.

@kopiczko

This comment was marked as outdated.

@Adirio
Copy link
Contributor

Adirio commented Apr 19, 2021

More than an issue, they are a unsupported feature. We only support webhooks for types we have scaffolded ourselves.

@camilamacedo86 camilamacedo86 added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Apr 20, 2021
@camilamacedo86 camilamacedo86 added this to the 3.* milestone Apr 20, 2021
@kopiczko

This comment was marked as outdated.

@estroz

This comment was marked as outdated.

@fejta-bot

This comment was marked as outdated.

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2021
@k8s-triage-robot

This comment was marked as outdated.

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 19, 2021
@k8s-triage-robot

This comment was marked as outdated.

@k8s-ci-robot

This comment was marked as outdated.

@kebyn

This comment was marked as outdated.

@k8s-ci-robot

This comment was marked as outdated.

@estroz
Copy link
Contributor Author

estroz commented Jan 7, 2022

/reopen
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot reopened this Jan 7, 2022
@k8s-ci-robot

This comment was marked as outdated.

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jan 7, 2022
@k8s-triage-robot

This comment was marked as outdated.

@k8s-ci-robot k8s-ci-robot removed the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Feb 8, 2023
@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Feb 11, 2023
@camilamacedo86 camilamacedo86 modified the milestones: 3.*, priority Feb 11, 2023
@cloudziu
Copy link

Hello, do you plan to add scaffolding webhooks for core resources?

@camilamacedo86
Copy link
Member

camilamacedo86 commented Sep 15, 2024

Hello, do you plan to add scaffolding webhooks for core resources?

Yes, we should do that as we do for controllers.
we are able to scaffold controllers for Core Types nowadays so we should do the same for webhooks.
After we get merged #4150 it might be eiser because the of the changes in the code of SetupManager

Then to achieve this goal we will need to

- controller: true
  domain: testproject.org
  kind: Pod
  path: <we should add the endpoint for the core api >
  version: v1
  webhooks:
    conversion: true
    defaulting: true
    validation: true
    webhookVersion: v1

Such as we do when we scaffold a controller for a Core Type:

- controller: true
  group: apps
  kind: Deployment
  path: k8s.io/api/apps/v1 <- See
  • We will need to either update the referent docs to let users know how to do that.
  • By last add to the generate.sh a call as follows so that we get it tests under the generation of testdata samples.
    # Create webhook for core type
    $kb create webhook --group "" --version v1 --kind Pod --programmatic-validation --conversion --defaulting

@camilamacedo86 camilamacedo86 added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
9 participants