Skip to content

Commit

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

[release-1.4] 🐛 Fix KCP Controller reconcile always return error when workload cluster is unreachable
  • Loading branch information
k8s-ci-robot authored Sep 18, 2023
2 parents dba96ae + 7062300 commit 41e2c45
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 41e2c45

Please sign in to comment.