Skip to content

Commit

Permalink
Ensure that etcd health check errors are logged.
Browse files Browse the repository at this point in the history
Update controlplane/kubeadm/controllers/controller.go

Co-authored-by: Vince Prignano <vince@vincepri.com>
  • Loading branch information
Arvinderpal and vincepri committed Jul 15, 2020
1 parent 4e07b0c commit 69651a7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions controlplane/kubeadm/controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,19 +433,17 @@ func (r *KubeadmControlPlaneReconciler) reconcileHealth(ctx context.Context, clu

// Ensure etcd is healthy
if err := r.managementCluster.TargetClusterEtcdIsHealthy(ctx, util.ObjectKey(cluster)); err != nil {
logger.V(2).Info("Waiting for control plane to pass etcd health check to continue reconciliation", "cause", err)
r.recorder.Eventf(kcp, corev1.EventTypeWarning, "ControlPlaneUnhealthy",
"Waiting for control plane to pass etcd health check to continue reconciliation: %v", err)
// If there are any etcd members that do not have corresponding nodes, remove them from etcd and from the kubeadm configmap.
// This will solve issues related to manual control-plane machine deletion.
workloadCluster, err := r.managementCluster.GetWorkloadCluster(ctx, util.ObjectKey(cluster))
if err != nil {
return err
}
if err := workloadCluster.ReconcileEtcdMembers(ctx); err != nil {
logger.V(2).Info("cannot get remote client to workload cluster", "cause", err)
} else if err := workloadCluster.ReconcileEtcdMembers(ctx); err != nil {
logger.V(2).Info("Failed attempt to remove potential hanging etcd members to pass etcd health check to continue reconciliation", "cause", err)
}

logger.V(2).Info("Waiting for control plane to pass etcd health check to continue reconciliation", "cause", err)
r.recorder.Eventf(kcp, corev1.EventTypeWarning, "ControlPlaneUnhealthy",
"Waiting for control plane to pass etcd health check to continue reconciliation: %v", err)
return &capierrors.RequeueAfterError{RequeueAfter: healthCheckFailedRequeueAfter}
}

Expand Down

0 comments on commit 69651a7

Please sign in to comment.