Skip to content

Commit

Permalink
Merge pull request #9448 from sbueringer/pr-optimize-kcp
Browse files Browse the repository at this point in the history
🌱 Remove redundant GetRESTConfig in KCP Management.GetWorkloadCluster
  • Loading branch information
k8s-ci-robot committed Sep 18, 2023
2 parents 6e42d6f + edc8020 commit 1cd6b2a
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions controlplane/kubeadm/internal/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,11 @@ func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.O
restConfig = rest.CopyConfig(restConfig)
restConfig.Timeout = 30 * time.Second

if m.Tracker == nil {
return nil, errors.New("Cannot get WorkloadCluster: No remote Cluster Cache")
}

c, err := m.Tracker.GetClient(ctx, clusterKey)
if err != nil {
return nil, &RemoteClusterConnectionError{Name: clusterKey.String(), Err: err}
}

clientConfig, err := m.Tracker.GetRESTConfig(ctx, clusterKey)
if err != nil {
return nil, &RemoteClusterConnectionError{Name: clusterKey.String(), Err: err}
}

// Make sure we use the same CA and Host as the client.
// Note: This has to be done to be able to communicate directly on self-hosted clusters.
restConfig.CAData = clientConfig.CAData
restConfig.CAFile = clientConfig.CAFile
restConfig.Host = clientConfig.Host

// Retrieves the etcd CA key Pair
crtData, keyData, err := m.getEtcdCAKeyPair(ctx, clusterKey)
if err != nil {
Expand Down

0 comments on commit 1cd6b2a

Please sign in to comment.