Skip to content

Commit

Permalink
Remove redundant GetRESTConfig in KCP Management.GetWorkloadCluster
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer [email protected]
  • Loading branch information
sbueringer authored and k8s-infra-cherrypick-robot committed Sep 18, 2023
1 parent 132b9a6 commit 9b8f60b
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 9b8f60b

Please sign in to comment.