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

Ability to turn off mutating main.go when adding apis/webhooks #1724

Closed
christopherhein opened this issue Oct 15, 2020 · 7 comments
Closed
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/blocked

Comments

@christopherhein
Copy link
Member

It would be nice to be able to set in the PROJECT that you didn't want the scaffolding to update main.go this would allow scaffolding to work for projects that move their scheme/controller initialization to another directory like cmd/. Today this still works properly if you are using it to create api but when you use create webhook it will fail and none of the files are created properly.

sigs.k8s.io/kb-test: k8s:kind-kind                                                                                                                                                               
→ kubebuilder init --domain example.com                                                                                                                                                          
Writing scaffold for you to edit...                                                                                                                                                              
Get controller runtime:                                                                                                                                                                          
$ go get sigs.k8s.io/controller-runtime@v0.5.0                                                                                                                                                   
Update go.mod:                                                                                                                                                                                   
$ go mod tidy                                                                                                                                                                                    
Running make:                                                                                                                                                                                   
$ make                                                                                                                                                                                           
/Users/chris/Code/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."                                                                                                   
go fmt ./...                                                                                                                                                                                
go vet ./...                                                                                                                                                                                    
                                                                                                                                                                                              
go build -o bin/manager main.go
Next: define a resource with:
$ kubebuilder create api
insigs.k8s.io/kb-test: k8s:kind-kind
→ mkdir cmd
sigs.k8s.io/kb-test: k8s:kind-kind
→ mv main.go cmd
sigs.k8s.io/kb-test: k8s:kind-kind
→ kubebuilder create api --group crew --version v1beta1 --kind Frigate                           
Create Resource [y/n]
y
Create Controller [y/n]
y
Writing scaffold for you to edit...
api/v1beta1/frigate_types.go
controllers/frigate_controller.go
2020/10/11 14:41:14 failed to create API: error updating main.go: failed to open main.go: open main.go: no such file or directory
sigs.k8s.io/kb-test: k8s:kind-kind
→ ls -al api/v1beta1/
  rwx------  chris  staff   128 B    Sun Oct 11 14:41:14 2020    ./
  rwx------  chris  staff    96 B    Sun Oct 11 14:41:14 2020    ../
  rw-------  chris  staff     1 KiB  Sun Oct 11 14:41:14 2020    frigate_types.go 
  rw-------  chris  staff     1 KiB  Sun Oct 11 14:41:14 2020    groupversion_info.go 
sigs.k8s.io/kb-test: k8s:kind-kind
→ kubebuilder create webhook --defaulting --kind Frigate --group crew --version v1beta1          
Writing scaffold for you to edit...
api/v1beta1/frigate_webhook.go
2020/10/11 14:42:59 failed to create webhook: failed to open main.go: open main.go: no such file or directory
sigs.k8s.io/kb-test: k8s:kind-kind
→ ls -al api/v1beta1/                           
  rwx------  chris  staff   128 B    Sun Oct 11 14:41:14 2020    ./
  rwx------  chris  staff    96 B    Sun Oct 11 14:41:14 2020    ../
  rw-------  chris  staff     1 KiB  Sun Oct 11 14:41:14 2020    frigate_types.go 
  rw-------  chris  staff     1 KiB  Sun Oct 11 14:41:14 2020    groupversion_info.go 

RFE was requested from conversations in #1719

/kind feature

@christopherhein christopherhein added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 15, 2020
@christopherhein christopherhein changed the title Ability to turn off mutating main.go Ability to turn off mutating main.go when adding apis/webhooks Oct 15, 2020
@camilamacedo86
Copy link
Member

Hi @christopherhein,

Thank you for raise that.

It shows related to the issue #932. See the comment #932 (comment). In this way, it shows blocked until we are able to have the plugin phase 2 implemented to know how better we could address this scenario.

@camilamacedo86
Copy link
Member

We discussed it in the bug triage meeting and then, was really decide that we might wait for the plugin phase 2 as well.

@christopherhein
Copy link
Member Author

Sounds good, thanks @camilamacedo86 !

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

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

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@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 Jan 19, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

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

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@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 Feb 18, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/blocked
Projects
None yet
Development

No branches or pull requests

4 participants