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 buringerst@vmware.com
  • Loading branch information
sbueringer committed Sep 18, 2023
1 parent 2e0acc6 commit edc8020
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 edc8020

Please sign in to comment.