Skip to content

Commit

Permalink
🐛 Fix KCP Controller reconcile always return error when workload clus…
Browse files Browse the repository at this point in the history
…ter is unreachable
  • Loading branch information
Levi080513 authored and k8s-infra-cherrypick-robot committed Sep 18, 2023
1 parent dba96ae commit 7062300
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controlplane/kubeadm/internal/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.O
// TODO(chuckha): memoize this function. The workload client only exists as long as a reconciliation loop.
restConfig, err := remote.RESTConfig(ctx, KubeadmControlPlaneControllerName, m.Client, clusterKey)
if err != nil {
return nil, err
return nil, &RemoteClusterConnectionError{Name: clusterKey.String(), Err: err}
}
restConfig.Timeout = 30 * time.Second

Expand All @@ -114,12 +114,12 @@ func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.O

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

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

// Make sure we use the same CA and Host as the client.
Expand Down

0 comments on commit 7062300

Please sign in to comment.