Skip to content
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

cluster: scope-down dynamic and discovery clients #231

Merged

Conversation

stevekuznetsov
Copy link
Contributor

@stevekuznetsov stevekuznetsov commented Nov 23, 2021

cluster: scope-down dynamic and discovery clients

Instead of expecting a separate kubeconfig context entry for every
possible logical cluster we need to operate over, use the client-go
helpers for scoping down a cluster-less dynamic client or discovery
client to a cluster-scoped one, as needed.

Signed-off-by: Steve Kuznetsov skuznets@redhat.com


requires kcp-dev/kubernetes#22
Fixes #236

@stevekuznetsov stevekuznetsov changed the title Skuznets/use cluster clients cluster: scope-down dynamic and discovery clients Nov 23, 2021
go.mod Outdated Show resolved Hide resolved
pkg/syncer/syncer.go Outdated Show resolved Hide resolved
@stevekuznetsov
Copy link
Contributor Author

Fixes #236

@ncdc
Copy link
Member

ncdc commented Nov 23, 2021

Need to put the fixes details in the PR description to have it auto-close the issue on merge

@stevekuznetsov stevekuznetsov force-pushed the skuznets/use-cluster-clients branch 5 times, most recently from deb4ea4 to 04557c8 Compare November 23, 2021 20:16
@stevekuznetsov
Copy link
Contributor Author

This is now just failing on syncing data back from the pcluster to the kcp, with:

E1123 12:06:36.406291 1604091 reflector.go:138] k8s.io/client-go/dynamic/dynamicinformer/informer.go:91: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: the server could not find the requested resource

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
Instead of expecting a separate kubeconfig context entry for every
possible logical cluster we need to operate over, use the client-go
helpers for scoping down a cluster-less dynamic client or discovery
client to a cluster-scoped one, as needed.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
@stevekuznetsov
Copy link
Contributor Author

OK, should be working now. Added an e2e.

@stevekuznetsov
Copy link
Contributor Author

Note: I will move both this and the sharding "e2e" into the Go-based tests once the framework lands. I know the shell is quite the mouthful but let's just use it as a stop-gap until we have the better approach.

@@ -27,7 +27,14 @@ func deepEqualStatus(oldObj, newObj interface{}) bool {
return equality.Semantic.DeepEqual(oldStatus, newStatus)
}

const statusSyncerAgent = "kcp#status-syncer/v0.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something I would like to see everywhere, for every controller and component we build. Is therre a good place to add this centrally? E.g. in the kcp startup code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but //TODO?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, as convention

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
When you have lots of clients going in both directions it's nice to be
able to tell what's going where and why. The user-agent helps with that.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
@stevekuznetsov stevekuznetsov merged commit 9d733b1 into kcp-dev:main Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster controller unable to sync - can't find context
3 participants