From f9e4d28a7eb59a9d5c54e181f79b0fcc66635eb5 Mon Sep 17 00:00:00 2001 From: Jiayi Wang Date: Mon, 9 Jan 2023 15:41:05 -0500 Subject: [PATCH 23/34] Mark etcd machine status to running after etcd controller adds the etcd machine ready label --- api/v1beta1/machine_types.go | 5 ++++- internal/controllers/machine/machine_controller_phases.go | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/v1beta1/machine_types.go b/api/v1beta1/machine_types.go index ee4c40b5a..76d235a38 100644 --- a/api/v1beta1/machine_types.go +++ b/api/v1beta1/machine_types.go @@ -30,9 +30,12 @@ const ( // MachineControlPlaneLabel is the label set on machines or related objects that are part of a control plane. MachineControlPlaneLabel = "cluster.x-k8s.io/control-plane" - //MachineEtcdClusterLabelName is the label set on machines or related objects that are part of an etcd cluster + // MachineEtcdClusterLabelName is the label set on machines or related objects that are part of an etcd cluster MachineEtcdClusterLabelName = "cluster.x-k8s.io/etcd-cluster" + // MachineEtcdReadyLabelName is the label set on machines that have succesfully joined the etcd cluster. + MachineEtcdReadyLabelName = "cluster.x-k8s.io/etcd-ready" + // ExcludeNodeDrainingAnnotation annotation explicitly skips node draining if set. ExcludeNodeDrainingAnnotation = "machine.cluster.x-k8s.io/exclude-node-draining" diff --git a/internal/controllers/machine/machine_controller_phases.go b/internal/controllers/machine/machine_controller_phases.go index 4181ca366..5e846594a 100644 --- a/internal/controllers/machine/machine_controller_phases.go +++ b/internal/controllers/machine/machine_controller_phases.go @@ -72,8 +72,7 @@ func (r *Reconciler) reconcilePhase(_ context.Context, m *clusterv1.Machine) { } if _, ok := m.Labels[clusterv1.MachineEtcdClusterLabelName]; ok { - // Status.NodeRef does not get set for etcd machines since they don't correspond to k8s node objects - if m.Status.InfrastructureReady { + if _, ok := m.Labels[clusterv1.MachineEtcdReadyLabelName]; ok && m.Status.InfrastructureReady { m.Status.SetTypedPhase(clusterv1.MachinePhaseRunning) } } -- 2.40.0