Comments (8)
cc @mattmoor in case you have more references to usages
from pkg.
We use this downstream to inject clients that exhibit different behavior.
cc @wlynch who I know spent a bunch of time looking at improving things a few weeks ago to streamline updates.
from pkg.
exhibit different behavior.
In what way?
We use this downstream...
I'm thinking of making the generation optional - so you can just generate these yourself downstream
from pkg.
@dprotaso I think for downstream codegen to work, the clients would need to be in their own go module, so that folks can go mod -replace
with additional options.
from pkg.
I don't understand - can you elaborate?
I'm suggesting downstream add a generation script like so
Lines 46 to 54 in db8a353
But add a flag --force-dynamic-clients
or something to get the extra dynamic stuff
from pkg.
So looking at all the downstream packages that depend on injection.Dynamic
I only see registration of dynamic clients and informers (due to codegen/cargo culting with no actual use).
The only downstream dependency that seems to setup the context with a dynamic client is tekton triggers
cache/github.com/tektoncd/triggers@v0.24.0/cmd/eventlistenersink/main.go: ctx = injection.Dynamic.SetupDynamic(ctx)
But then they setup the injection.Default
Informers and clients overriding everything. So injection.Dynamic
doesn't really have any usage.
Also based on #2210
One of the long-standing motivations for the injection-based controller architecture has been to enable us to synthesize different backing implementations, which can be made available to controller constructors by substituting what foo.Get(ctx) accesses.
I agree with this statement but I would envision the implementation to just use the same object graph as injection.Default
vs. a separate one
ie. I would setup things this way
import "context"
import "k8s.io/client-go/dynamic"
import "knative.dev/pkg/client/injection/kube/client"
import "knative.dev/pkg/injection/clients/dynamicclient"
func main() {
ctx := context.Background()
dc := dynamic.NewForConfigOrDie(cfg)
ctx = context.WithValue(ctx, dynamicclient.Key{}, dynamic.NewForConfigOrDie(cfg))
ctx = context.WithValue(ctx, client.Key{}, myOwnKubernetesWrapper{dc})
... := injection.Default.SetupInformers(ctx)
}
type myOwnKubernetesWrapper struct {
dc *dynamic.Client
}
var _ kubernetes.Interface = (*myOwnKubernetesWrapper)(nil)
Based on all this I'm inclined to delete the wrapped client, the informers, and injection.Dynamic
- it should be fairly trivial to just remove registrations downstream (cause it's all done via codegen)
from pkg.
Thanks for the assessment @dprotaso !
from pkg.
Related Issues (20)
- Fix linter errors HOT 2
- queue-proxy nil pointer dereference HOT 1
- Downstream Tekton failures HOT 3
- Feature: Generic admission webhook HOT 4
- Identical version referenced in status.ConvertTo HOT 6
- Consider putting the admission review on the webhook context HOT 11
- kmeta package: ChildName function produces invalid resource names HOT 1
- Allow reconcilers to listen to leader promotion events HOT 3
- reconcilerImpl.updateStatus method performance impacted by state difference calculation used in debug mode only
- Make ZipkinTracingEnabled flag thread safe HOT 1
- Support creating TLS servers with mutual trust HOT 2
- Eventing TLS: Update Addressable and AddressStatus HOT 2
- Eventing TLS: Update Destination and KReference HOT 2
- Eventing TLS: Add AddressableFromDestination method on the resolver HOT 2
- Kubernetes 1.26/1.27 support HOT 7
- Drop use of https://github.com/gorilla/websocket HOT 2
- Eventing TLS: Add SinkCACerts to SourceStatus HOT 1
- Bump Min K8s version to 1.25
- Eventing TLS: validate that `Destination.CACerts` is a PEM encoded cert HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkg.