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

Can't define Default method for kinds watched by multiple controllers #483

Closed
ekuefler opened this issue Jun 10, 2019 · 1 comment · Fixed by #486
Closed

Can't define Default method for kinds watched by multiple controllers #483

ekuefler opened this issue Jun 10, 2019 · 1 comment · Fixed by #486
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.

Comments

@ekuefler
Copy link
Contributor

My manager installs multiple controllers for the same kind. If I define a Default() method for that kind, I get an error on startup:

2019-06-10T16:42:05.355-0700	INFO	controller-runtime.builder	Registering a mutating webhook	{"GVK": "my-group/v1alpha1, Kind=MyKind", "path": "/mutate-my-group-v1-alpha1-my-kind"}
panic: can't register duplicate path: /mutate-my-group-v1-alpha1-my-kind

goroutine 1 [running]:
sigs.k8s.io/controller-runtime/pkg/webhook.(*Server).Register(0xc0004510e0, 0xc0000e83c0, 0x41, 0x16f2dc0, 0xc0003f5110)
	/home/ekuefler/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.0-beta.0/pkg/webhook/server.go:96 +0x25a
sigs.k8s.io/controller-runtime/pkg/builder.(*Builder).doWebhook(0xc000411300, 0x16f1360, 0xc0003f50b0)
	/home/ekuefler/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.0-beta.0/pkg/builder/build.go:274 +0x89c
sigs.k8s.io/controller-runtime/pkg/builder.(*Builder).Build(0xc000411300, 0x16f1360, 0xc0003f50b0, 0x0, 0x1, 0xc000495180, 0x0)
	/home/ekuefler/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.0-beta.0/pkg/builder/build.go:164 +0xcc
sigs.k8s.io/controller-runtime/pkg/builder.(*Builder).Complete(...)
	/home/ekuefler/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.0-beta.0/pkg/builder/build.go:136
environments/controllers/localhost.(*ConfigMapReconciler).setupWithManager(0xc0003f50b0, 0x17478c0, 0xc0002fb680, 0x172ce60, 0xc0004aaf60)
	/home/ekuefler/environments/controllers/localhost/config_map_reconciler.go:91 +0xfd
environments/controllers/localhost.(*Reconciler).SetupWithManager(0xc000127ea8, 0x17478c0, 0xc0002fb680, 0x172ce60, 0xc0004aab40)
	/home/ekuefler/environments/controllers/localhost/reconciler.go:32 +0x1b8
main.main()
	/home/ekuefler/environments/main.go:55 +0x330

Presumably this is due to

blder.mgr.GetWebhookServer().Register(path, mwh)
, where the builder tries to register a new path in the manager every time a controller is created.

I may be doing something wrong, as the webhook stuff seems mostly undocumented and I'm just trying to figure it out by picking through code.

@DirectXMan12
Copy link
Contributor

cc @mengqiy

/kind bug
/priority critical-urgent

this is definitely a bug. If we've got multiple controllers for the same kind, we can't multi-register.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
3 participants