With this change, I was able to pass some downstream e2e tests that check for event emission with this path enabled, which previously failed.
The relevant hand-rolled bits in Kubernetes client-go is here: 35bf219cc6/kubernetes/typed/core/v1/event_expansion.go (L49)
I opted to avoid copy/pasting the generated code, and instead used a trick that let me call into the generated code.
Going through this exercise also (likely) uncovered a Kubernetes bug: https://github.com/kubernetes/kubernetes/issues/104495
* 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.
I noticed in a few places downstream that reconcilers were creating both trackers and Addressable resolvers, which seems superfluous. As part of examining the way we use the tracker, I'm experimenting with changing this to just take a tracker.
* 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.
* Use consistent case for "Deprecated" comments
Not the most important thing ever, but the canonical string to use for
Deprecated warnings is case sensitive, and also it's nice to be
consistent.
* Add nolint comment
I noticed doing some tinkering that these were running on every iteration, but the inputs don't change. This sinks the calls to below the loop, and reduces things to a single call for each.
This is modelled after some of the semantics available in controller-runtime's `Result` type, which allows reconcilers to indicate a desire to reprocess a key either immediately or after a delay.
I worked around our lack of this when I reworked Tekton's timeout handling logic by exposing a "snooze" function to the Reconciler that wrapped `EnqueueAfter`, but this feels like a cleaner API for folks to use in general, and is consistent with our `NewPermanentError` and `NewSkipKey` functions in terms of influencing the queuing behaviors in our reconcilers via wrapped errors.
You can see some discussion of this here: https://knative.slack.com/archives/CA4DNJ9A4/p1627524921161100
* drop stack driver as a tracing backend
* drop stackdriver as a metrics backend
* update deps - dropping stackdriver
* fix linting issues
* drop further references to stack driver
* drop serving & eventing metric key constants
these have been moved to their respective repos
see: https://github.com/knative/pkg/issues/608
* move source metrickeys to pkg/source
We're going to move the StatsReporter downstream eventually
related:
https://github.com/knative/eventing/pull/5587https://github.com/knative/eventing/pull/5586
* fix linter