Skip to content

Commit f0bc103

Browse files
authored
Merge pull request kubernetes-sigs#2451 from sethp-nr/patch-2
🐛 Report all KCP healthcheck errors
2 parents ce51864 + 4cfa74a commit f0bc103

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

controlplane/kubeadm/internal/cluster.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ type healthCheck func(context.Context) (healthCheckResult, error)
121121
// healthCheck will run a generic health check function and report any errors discovered.
122122
// It does some additional validation to make sure there is a 1;1 match between nodes and machines.
123123
func (m *ManagementCluster) healthCheck(ctx context.Context, check healthCheck, clusterKey types.NamespacedName, controlPlaneName string) error {
124+
var errorList []error
124125
nodeChecks, err := check(ctx)
125126
if err != nil {
126-
return err
127+
errorList = append(errorList, err)
127128
}
128-
errorList := []error{}
129129
for nodeName, err := range nodeChecks {
130130
if err != nil {
131131
errorList = append(errorList, fmt.Errorf("node %q: %v", nodeName, err))
@@ -469,6 +469,10 @@ func (c *cluster) etcdIsHealthy(ctx context.Context) (healthCheckResult, error)
469469
}
470470
}
471471

472+
if len(response) > 0 {
473+
return response, errors.New("could not check etcd member health")
474+
}
475+
472476
// Check that there is exactly one etcd member for every control plane machine.
473477
// There should be no etcd members added "out of band.""
474478
if len(controlPlaneNodes.Items) != len(knownMemberIDSet) {

0 commit comments

Comments
 (0)