Skip to content

Commit 2e0acc6

Browse files
authored
Merge pull request kubernetes-sigs#9342 from smartxworks/huangwei/fix-always-reconcile-error-when-cp-unreachable
🐛 Fix KCP Controller reconcile always return error when workload cluster is unreachable
2 parents 90537d1 + cd66c61 commit 2e0acc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controlplane/kubeadm/internal/cluster.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.O
107107
// TODO(chuckha): memoize this function. The workload client only exists as long as a reconciliation loop.
108108
restConfig, err := m.Tracker.GetRESTConfig(ctx, clusterKey)
109109
if err != nil {
110-
return nil, err
110+
return nil, &RemoteClusterConnectionError{Name: clusterKey.String(), Err: err}
111111
}
112112
restConfig = rest.CopyConfig(restConfig)
113113
restConfig.Timeout = 30 * time.Second
@@ -118,12 +118,12 @@ func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.O
118118

119119
c, err := m.Tracker.GetClient(ctx, clusterKey)
120120
if err != nil {
121-
return nil, err
121+
return nil, &RemoteClusterConnectionError{Name: clusterKey.String(), Err: err}
122122
}
123123

124124
clientConfig, err := m.Tracker.GetRESTConfig(ctx, clusterKey)
125125
if err != nil {
126-
return nil, err
126+
return nil, &RemoteClusterConnectionError{Name: clusterKey.String(), Err: err}
127127
}
128128

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

0 commit comments

Comments
 (0)