Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Oct 21, 2020
1 parent 4bf1c4c commit ce2b44d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions controlplane/kubeadm/controllers/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
if c.IsEtcdManaged() {
canSafelyRemediate, err := r.canSafelyRemoveEtcdMember(ctx, c, machineToBeRemediated)
if err != nil {
conditions.MarkFalse(machineToBeRemediated, clusterv1.MachineOwnerRemediatedCondition, clusterv1.RemediationFailedReason, clusterv1.ConditionSeverityError, err.Error())
return ctrl.Result{}, err
}

Expand All @@ -121,6 +122,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
return ctrl.Result{}, errors.Wrapf(err, "failed to delete unhealthy machine %s", machineToBeRemediated.Name)
}

logger.Info("Remediating unhealthy machine", "UnhealthyMachine", machineToBeRemediated.Name)
conditions.MarkFalse(machineToBeRemediated, clusterv1.MachineOwnerRemediatedCondition, clusterv1.RemediationInProgressReason, clusterv1.ConditionSeverityWarning, "")
return ctrl.Result{Requeue: true}, nil
}
Expand Down
3 changes: 2 additions & 1 deletion controlplane/kubeadm/internal/workload_cluster_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,11 @@ func (w *Workload) EtcdStatus(ctx context.Context) ([]EtcdMemberStatus, error) {
return nil, errors.Wrap(err, "failed to list control plane nodes")
}

etcdClient, err := w.etcdClientGenerator.forNodes(ctx, nodes.Items)
etcdClient, err := w.etcdClientGenerator.forLeader(ctx, nodes.Items)
if err != nil {
return nil, errors.Wrap(err, "failed to create etcd client")
}
defer etcdClient.Close()

members, err := etcdClient.Members(ctx)
if err != nil {
Expand Down

0 comments on commit ce2b44d

Please sign in to comment.