* 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.
* Some nits in the genreconciler
- make sure we allocate proper amount of slice space
- `t:=t` is needed only if you're doing goroutines in the loop
- extract constants outside of the loops.
- reformat
* meh, I was wrong
* generate krshaped logic
* add logic to the tag
* Update injection/README.md
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* move var to reconciler
Co-authored-by: Matt Moore <mattmoor@vmware.com>
* Add the ability to override controller agent name
- controller can set agent name via context. If nothing is set then
controller falls back to default controller agent name
* Check if context name is not nil and can be casted to string before returning.
* Create EventRecorder after we determine the controller agent name
* Address comments
Signed-off-by: Andrew Su <asu@pivotal.io>
* Remove check for if recorder is nil
Co-authored-by: Andrew Su <asu@pivotal.io>
This changes the names we give workqueues in genreconciler to avoid collisions when multiple reconcilers in a single process use the same generated reconciler base.
There are a few examples of this in serving, both route and configuration have collisions. Right now I think this mainly affects metrics published by the workqueues, but I noticed this leveraging the same for resource lock naming.
* genreconciler:nonNamespaced
* Adding a force-kinds flag to the reconciler generator to allow us to generate reconcilers for non-owned types.
* force-kinds --> force-genreconciler-kinds
* some minor nits with the generators for non-knative types needed to be removed.
* remove whitespace
Co-authored-by: Nacho Cano <nachoacano@gmail.com>
* looking at annotations for group overrides.
* checkpoint.
* checkpoint
* I think it is correct.
* ok
* trim down the files.
* simulate tekton
* working test out of checkin
* remove test client
* update docs
* and test.
* lint
* it ok
* update codegen
* fix rando issues
* code in the group for finalizer name.
* Use FinalizeKind
* show the Finalizer interface.
* removing isFinalizing
* sync finalizers before calling reconcilekind
* missed the events change.
* adding a reconciler generator to use as the base reconcilers for all of knative.
* mend
* fix tag names.
* use reconciler events
* trying new thing.
* base working reconciler gen
* working cleaned up reconciler generator.
* fix typo
* fix some ordering.
* fix interface path
* fix whitespace
* update deps.
* updates based on feedback.
* Remove core loop.
* reconcilerImpl
* add NewReconciler
* Fix copyright header
* Comment out finalizers
* remove finalizers from generated code.
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`.
* update codegen so the fatal error messages are more informative
String representation of an untyped nil is 'nil' so the Fatal messages weren't useful
* generate k8s injection code
* generate apiextensions injection code
* use Fatal & move output paths
* switch from Fatal to Panic
* injection creates a single factory