Skip to content

Commit

Permalink
Merge pull request #9451 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…9448-to-release-1.5

[release-1.5] 🌱 Remove redundant GetRESTConfig in KCP Management.GetWorkloadCluster
  • Loading branch information
k8s-ci-robot authored Sep 18, 2023
2 parents 132b9a6 + 9b8f60b commit 377b5ef
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 377b5ef

Please sign in to comment.