Description
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?