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

Unable to create webhook for core type #4747

Closed
ahmedwaleedmalik opened this issue Apr 12, 2021 · 8 comments
Closed

Unable to create webhook for core type #4747

ahmedwaleedmalik opened this issue Apr 12, 2021 · 8 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Milestone

Comments

@ahmedwaleedmalik
Copy link
Contributor

Bug Report

What did you do?

I am trying to add a webhook for an existing core resource but unable to do so. Reproducible with the following steps:

operator-sdk create api --group "apps" --kind "Deployment" --version "v1" --resource=false --controller=true
operator-sdk create webhook --group "apps" --kind "Deployment" --version "v1" --defaulting --programmatic-validation

What did you see instead? Under which circumstances?

Got the following error:

Error: failed to create webhook with "go.kubebuilder.io/v2": operator-sdk create webhook requires an api with the group, kind and version provided
Usage:
  operator-sdk create webhook [flags]

Examples:
  # Create defaulting and validating webhooks for CRD of group ship, version v1beta1
  # and kind Frigate.
  operator-sdk create webhook --group ship --version v1beta1 --kind Frigate --defaulting --programmatic-validation

  # Create conversion webhook for CRD of group shio, version v1beta1 and kind Frigate.
  operator-sdk create webhook --group ship --version v1beta1 --kind Frigate --conversion


Flags:
      --conversion                if set, scaffold the conversion webhook
      --defaulting                if set, scaffold the defaulting webhook
      --group string              resource Group
  -h, --help                      help for webhook
      --kind string               resource Kind
      --programmatic-validation   if set, scaffold the validating webhook
      --resource string           resource Resource
      --version string            resource Version

Global Flags:
      --verbose   Enable verbose logging

FATA[0000] failed to create webhook with "go.kubebuilder.io/v2": operator-sdk create webhook requires an api with the group, kind and version provided 

Environment

Openshift v4.6.13

Operator type:

/language go

Kubernetes cluster type:

$ operator-sdk version

operator-sdk version: "v1.4.0", commit: "67f9c8b888887d18cd38bb6fd85cf3cf5b94fd99", kubernetes version: "1.19.4", go version: "go1.15.5", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.16 linux/amd64

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:28:09Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0+3b01205", GitCommit:"3b012051f912a6e29337c4087fcfc8161651690b", GitTreeState:"clean", BuildDate:"2021-01-16T09:10:53Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

@camilamacedo86
Copy link
Contributor

camilamacedo86 commented Apr 12, 2021

As we spoke about core/external types are not fully supported yet, and you need to create the api with resource true as a workaround and make the required adjustments manually. See the RFE: kubernetes-sigs/kubebuilder#1999

@estroz
Copy link
Member

estroz commented Apr 12, 2021

create webhook does not support core types yet, as this comment says. There should be an error returned by create webhook for core types until some library/convenience function/scaffold is created to establish core type webhooks.

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 12, 2021
@estroz estroz added this to the Backlog milestone Apr 12, 2021
@estroz
Copy link
Member

estroz commented Apr 12, 2021

Created an issue in kubebuilder to return an error: kubernetes-sigs/kubebuilder#2141

@camilamacedo86
Copy link
Contributor

Hi @ahmedwaleedmalik,

See; https://book.kubebuilder.io/reference/webhook-for-core-types.html

The KB/SDK CLI tool is what does not support that because it is not implemented with IHMO should be addressed as part of RFE: kubernetes-sigs/kubebuilder#1999. However, I hope that this doc helps you with.

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 12, 2021
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot 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 11, 2021
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this as completed Sep 10, 2021
@openshift-ci
Copy link

openshift-ci bot commented Sep 10, 2021

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/go Issue is related to a Go operator project lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants