This will show up like this in the log
13:35:17 Probes server listening on port %!s(int=8080)
with proper type casted it will look a bit better !
Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
* Support fetching configs from `ctx`.
This enables callers of `sharedmain` to infuse `ctx` with a `logging.Config` or `leaderelection.Config` instead of relying on the API server for it.
* Move context methods into appropriate packages, drop stutter
* 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>
Unfortunately the lister interfaces didn't plumb through `ctx` so
this is slightly more complex than I'd have liked. Instead of
threading the `resourceVersion` (bounded-staleness) through `ctx`
it is stored on the lister implementation.
It is seeded with `injection.WithResourceVersion` (ideally this
would have been all we needed, w/o state), and this state can be
updated by calling `SetResourceVersion`.
The stored `resourceVersion` is passed via `FooOptions` to `Get`
and `List` calls.
Fixes: a long-standing `TODO(mattmoor)`
* Introduce `NewContext`, deprecate `NewImplFull`.
Our generated `NewImpl` methods have long taken `context.Context`, but despite many iterations the forms we expose from our `controller` package never have. This change contains several elements:
1. Expose a new `NewContext` method that takes `context.Context` in addition to the current `NewImplFull` signature.
2. Call `NewContext` instead of the deprecated `NewImpl` from our generated controller code.
3. Call `NewContext` from all our webhook reconcilers.
* Add a Tracker to controller.Impl to cut down on downstream boilerplate.
* 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.
* bump k8s deps to v1.20.7
* fix migrator test pkg
* dynamicclient now expects List types to be declare either via a scheme or manually
* fix error message comparison
* drop excess vendor licenses
* Using the injection fake dynamic client will preserve pre-1.20 behaviour
This is accomplished by preprocessing the scheme/fixtures and declaring
a custom scheme were we map our types & lists to unstructured.* types
* revert webhook factory changes
* ensure objects to the dynamic client are unstructured
* seed the default dynamic client with k8s scheme
* include duckv1 types in default fake dynamic client scheme
* use default k8s scheme
looks like eventing adds to this scheme but we should import the correct one vs the one from the fake package
* drop duckv1 from default scheme
* set APIVersion/Kind if empty
* refactor ToUnstructured helper to a new package
* consolidate k8s flags to an environment package
* add copyright
* fix comment style
* use go1.16 in workflows so downstream tests work
* Deprecate GetRESTConfig and do not remove
* update copyright date
* 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
* Shush autogomaxproc.
I am not as sure about this change, but those logs are not following the standard formt
and given we need to inject the logger in init() makes this next to impossible.
Corollary, is that we set cpu limits on all our binaries, except QP, so it only mattered there
since otherwise the package logs nothing.
* m
* Allow override QPS and Burst via flag.
Add `--kube-api-qps` and `--kube-api-burst` command-line flags
to control client QPS and Burst respectively.
The default value is set to 0 to keep backward compatibility.
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
* Inline validation functions
Signed-off-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
* put EnableInjectionOrDie back on the main path
* nil check pointer type
* move enable injeciton out of sharedmain
* lint
* nit picking fmt....
* add documentation
* feedback cleanup
* injection.GetRESTConfig
* redirect code that moved:
The EnableInjectionOrDie starts informers immedidately in a go
routine, which changes the order of informer start and controller
setup. As a result setting resync period to informer handler will
be ignored as the informer is already started. Though this will
likely affect more components, changing the EnableInjectionOrDie
function will break the API, so this is a temporary solution to
fix all the controllers depending on sharedmain.