* Disable controllers using a flag
This patch allows disabling controllers when using a new `Main` function
called `MainNamed` which takes a list of `NamedControllerConstructor`.
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
* Apply reviews
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
* Add comments, split filter and conversion
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
* Allocate len(ctors)
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
* to disable -> disabling
Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
* This commit contains the actual changes to support dynamic client injection.
* Incorporate n3wscott review nits
* This includes the code-generation for the dynamic client-based injection.
This also includes a number of manually created files of the form `*_expansion.go`, which are needed to satisfy some of the Kubernetes manual type "expansions". At present, these are all simply `panic("NYI")`, but may become more than that in the future.
* add filtered InformerFactory and informers which only list and watch resources with the given labels
* rename to RegisterFilteredInformers
* generated files
* typo
* update per comments
* rename file
* rm old files
This augments the injection codegen with the capability to produce a duck.InformerFactory
attached to context for each type that we process.
Now a `duck.InformerFactory` for "Addressable" can be produced by "Get"ing it from the context.
This is triggered by placing `// +genduck` on the type that implements `duck.Implementable`.
This creates a base library that enables us to leverage the dependency
graph to convey injection dependencies. Our controllers will start
to get their informers off of a `context.Context` via `fooinformers.Get(ctx)`.
By simply linking `fooinformers` to access the informer in this way, we trigger
a cascade of `init`-time registrations for the informer, and its transitive
dependencies (e.g. shared informer factory, client).
The `ctx` is infused with these informers in `package main` by linking the
appropriate reconcilers (transitively registering everything) and then calling
`sharedmain.Main()` (from `github.com/knative/pkg/injection/sharedmain`).