* Extend Apply verb to extensions, Bump to K8s 1.22.
This was motivated by the linked issue, and does the work to upgrade PKG to 1.22 libs.
Fixes: https://github.com/knative/pkg/issues/2320
* 0.22.2 -> 0.22.5
* allow multiple values for comment tag keys
this will allow us to support multiple annotation keys
* add OR filter chain
* update codegen to support multiple annotation keys
* Preserve previous code & formatting if the number of annotation keys is 1
- preserve the order of the annotations vs. sorting it
- deprecate and don't remove ClassAnnotationKey to allow migration to happen smoothly
* fix default value for krshape
* include clarifying comment
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)`
* Bump apimachinery
* Update code-generator
* Update API and client, some progress
* Hack the generator to work at all
* Hack the PodDisruptionBudget extension to fulfill the interfaces
* Bump apiextensions as well
* Fix conflict
* Better condition
* Roll back unnecessary codegen change
* Fix PodDisruptionBudget extensions
* Panic on not-yet-implemented like others
* 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.
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.
* Fix codegen to work outside GOPATH
* Fix ReconcilerEvent handling of %w format strings
Using fmt.Errorf(...).Error() means we get %w's translated to %v's for
printing
* Add possibility to implement a deletion handler in a reconciler.
ObserveFinalizeKind is not guaranteed to be called for every resource
that gets deleted, even if they do have a finalizer. The leader can race
the observers in removing the finalizer so the observers would not even
see the deletion.
Using the OnDelete handler on the informer is equally racy in that it
can trigger the deletion handler while a potential "normal" reconcile is
still in-flight.
This adds an ObserveDeletedKind handler that can be implemented by
reconcilers. The events still go via the workQueue, so proper order and
deduplication is guaranteed. Observation is guaranteed as well. In most
if not all cases, this handler should replace the ObserveFinalizeKind
handler.
* Move interface to its own file
* Fix license
* Fix comment
* Fix#2003
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Removed useless newline
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Removed useless check
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Now we don't have any newlines anymore
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* 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 change introduces a new `controller.NewSkipKey` method to designate certain reconciliations as "skipped".
The primary motivation for this is to squelch useless logging on non-leader replicas, which currently report success with trivial latency.
I have plumbed this through existing reconcilers and the code-gen so most things downstream should get this for free. In places where a key is observed, I do not mark the reconcile as skipped as the reconciler did some processing for which the awareness of side-effects and reported latency may be interesting.
This uses the presence of the config key to determine whether
this is an injection context, and if it is not, the panic
message includes a notice about injection context behavior.
* use const when gen reconciler
* move to reconciler common
Signed-off-by: RyderXia <ryder.xia@sap.com>
* update
Signed-off-by: RyderXia <ryder.xia@sap.com>
* Add an option to skip automated status updates in a reconciler.
This option is necessary to be able to create reconcilers like Serving's labeler, that is purely adding labels to resources. If that fails, the new automated observed generation handling changes the status and that gets written to the API currently, which is not desired.
* Flip the bool.
* Abort reconcilation on finalizer patch errors.
This aborts reconcilation if finalizers could not be patched correctly with an error and thus it retries.
We shouldn't start a reconcilation if we haven't been able to correctly add the finalizer first. Otherwise we could get into a weird spot where the resources are created before the finalizer and in a very degenerate case the finalizer wouldn't even be executed. Also, the current code has a bug where if the patch fails the resource coming back from the patch (essentially an empty object) is passed into ReconcileKind, causing headaches.
The same imo goes for removing a finalizer. Failing to remove a finalizer blocks the resource forever, thus we should retry if that happens too.
* Add generated code.