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 aware Client does not use cluster aware RESTMapper #58

Open
RedbackThomson opened this issue Aug 29, 2024 · 4 comments
Open

Cluster aware Client does not use cluster aware RESTMapper #58

RedbackThomson opened this issue Aug 29, 2024 · 4 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@RedbackThomson
Copy link

I was attempting to access the logical cluster using a client generated using kcp.ClusterAwareClient, and kept running in to the following error:

failed to get API group resources: unable to retrieve the complete list of server APIs: core.kcp.io/v1alpha1: forbidden: User "kcp-admin" cannot get path "/services/apiexport/root/<redacted>/apis/core.kcp.io/v1alpha1": Path not resolved to a valid virtual workspace

Upon debugging, I determined that the client created using kcp.ClusterAwareClient does not include the cluster aware RESTMapper when creating the HTTPClient. Without this mapper, the client cannot resolve any APIExports and therefore cannot make any API requests to exported resources.

My work around for this was to use the kcp.NewClusterAwareClientForConfig, passing in the kcp.ClusterAwareHTTPClient explicitly, since NewClusterAwareClientForConfig DOES correctly set the mapper.

Is this the intended effect, that ClusterAwareClient does not include the mapper, or should I open a pull request making a ClusterAwareMapperProvider is the default?

@RedbackThomson
Copy link
Author

I do see #57 fixes this, but with a lot more complexity for a caching RESTMapper. Should I just wait for this to be merged, and use that? Or is it acceptable to simply pass the RESTMapper to the cluster aware client as it is today?

@sttts
Copy link
Member

sttts commented Aug 30, 2024

I had the impression that NewClusterAwareMapperProvider is not what we need because it only once switches from the root URL to /cluster/*, but it is not dynamic in a sense that it is aware of the cluster in the context. But you are saying it is because it uses the http wrapper that does the mapping.

@sttts
Copy link
Member

sttts commented Aug 30, 2024

In other words, that cluster aware mapper only does its thing once, and then serves the wrong information when you switch to another cluster.

@kcp-ci-bot
Copy link

Issues go stale after 90d of inactivity.
After a furter 30 days, they will turn rotten.
Mark the issue as fresh with /remove-lifecycle stale.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@kcp-ci-bot kcp-ci-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

3 participants