use cached discovery client
@@ -105,11 +105,6 @@ func newCluster(ctx context.Context, clientConfig clientcmd.ClientConfig, restCl
return nil, errors.Wrap(err, "create dynamic client")
}
- discoveryClient, err := discovery.NewDiscoveryClientForConfig(restClient)
- if err != nil {
- return nil, errors.Wrap(err, "create discovery client")
- }
-
dir, err := ioutil.TempDir("", "octant")
if err != nil {
return nil, errors.Wrap(err, "create temp directory")
@@ -134,7 +129,7 @@ func newCluster(ctx context.Context, clientConfig clientcmd.ClientConfig, restCl
restConfig: restClient,
kubernetesClient: kubernetesClient,
dynamicClient: dynamicClient,
- discoveryClient: discoveryClient,
+ discoveryClient: cachedDiscoveryClient,
restMapper: restMapper,
logger: internalLog.From(ctx),
defaultNamespace: defaultNamespace,
