-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop dynamic wrapped client generation #2739
Comments
cc @mattmoor in case you have more references to usages |
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. |
In what way?
I'm thinking of making the generation optional - so you can just generate these yourself downstream |
@dprotaso I think for downstream codegen to work, the clients would need to be in their own go module, so that folks can |
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 |
So looking at all the downstream packages that depend on 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 Also based on #2210
I agree with this statement but I would envision the implementation to just use the same object graph as 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 |
Thanks for the assessment @dprotaso ! |
Arf, this was used in |
See knative/pkg#2739. It doesn't seem it was used anywhere anyway. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
See knative/pkg#2739. It doesn't seem it was used anywhere anyway. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This does the following: - Update the dependency of knative/pkg to 1.11 - Update k8s reference to 1.25 as it's now the k8s min version supported - Remove "use" of injection.Dynamic (not really used) See knative/pkg#2739. It doesn't seem it was used anywhere anyway. - Handle AddEventHandler error. The `AddEventHandler` interface has changed and now returns an error (and a registration object that we do not need to use for now). This handles the error if any arise and also makes the linter happy :). Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This does the following: - Update the dependency of knative/pkg to 1.11 - Update k8s reference to 1.25 as it's now the k8s min version supported - Remove "use" of injection.Dynamic (not really used) See knative/pkg#2739. It doesn't seem it was used anywhere anyway. - Handle AddEventHandler error. The `AddEventHandler` interface has changed and now returns an error (and a registration object that we do not need to use for now). This handles the error if any arise and also makes the linter happy :). Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This does the following: - Update the dependency of knative/pkg to 1.11 - Update k8s reference to 1.25 as it's now the k8s min version supported - Remove "use" of injection.Dynamic (not really used) See knative/pkg#2739. It doesn't seem it was used anywhere anyway. - Handle AddEventHandler error. The `AddEventHandler` interface has changed and now returns an error (and a registration object that we do not need to use for now). This handles the error if any arise and also makes the linter happy :). Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
/assign @dprotaso
We have lots of code generation to support using a dynamic client driving a typed kubernetes interface. This was introduced in #2210 It's not clear if this is really being used anywhere.
What we do know is
-- Kubernetes 1.26/1.27 support #2725
I propose we drop this logic from
knative/pkg
The only use of the dynamic injection I found was tektoncd/triggers#1207 but they don't seem to use the wrapped clients
The text was updated successfully, but these errors were encountered: