Skip to content

Commit 94ebc1f

Browse files
Add v1beta2 Etcd and ControlPlaneComponents conditions to KCP
# Conflicts: # controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go
1 parent 93928cf commit 94ebc1f

File tree

6 files changed

+1070
-143
lines changed

6 files changed

+1070
-143
lines changed

api/v1beta1/v1beta2_condition_consts.go

+3
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ const (
139139
// This means that the object will go away (i.e. be removed from etcd), except if there are other
140140
// finalizers on the object.
141141
DeletionCompletedV1Beta2Reason = "DeletionCompleted"
142+
143+
// InspectionFailedV1Beta2Reason applies to a condition when inspection of the underlying object failed.
144+
InspectionFailedV1Beta2Reason = "InspectionFailed"
142145
)
143146

144147
// Conditions that will be used for the MachineSet object in v1Beta2 API version.

controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go

+95-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2020

2121
// KubeadmControlPlane's Available condition and corresponding reasons that will be used in v1Beta2 API version.
2222
const (
23-
// KubeadmControlPlaneAvailableV1Beta2Condition True if the control plane can be reached, EtcdClusterAvailable is true,
23+
// KubeadmControlPlaneAvailableV1Beta2Condition True if the control plane can be reached, EtcdClusterHealthy is true,
2424
// and CertificatesAvailable is true.
2525
KubeadmControlPlaneAvailableV1Beta2Condition = clusterv1.AvailableV1Beta2Condition
2626
)
@@ -40,12 +40,54 @@ const (
4040
KubeadmControlPlaneCertificatesAvailableV1Beta2Reason = clusterv1.AvailableV1Beta2Reason
4141
)
4242

43-
// KubeadmControlPlane's EtcdClusterAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
43+
// KubeadmControlPlane's EtcdClusterHealthy condition and corresponding reasons that will be used in v1Beta2 API version.
4444
const (
45-
// KubeadmControlPlaneEtcdClusterAvailableV1Beta2Condition surfaces issues to the managed etcd cluster, if any.
46-
// It is computed as aggregation of Machines's EtcdMemberHealthy (if not using an external etcd) conditions plus
47-
// additional checks validating potential issues to etcd quorum.
48-
KubeadmControlPlaneEtcdClusterAvailableV1Beta2Condition = "EtcdClusterAvailable"
45+
// KubeadmControlPlaneEtcdClusterHealthyV1Beta2Condition surfaces issues to etcd cluster hosted on machines managed by this object.
46+
// It is computed as aggregation of Machine's EtcdMemberHealthy conditions plus additional checks validating
47+
// potential issues to etcd quorum.
48+
// Note: this condition is not set when using an external etcd.
49+
KubeadmControlPlaneEtcdClusterHealthyV1Beta2Condition = "EtcdClusterHealthy"
50+
51+
// KubeadmControlPlaneEtcdClusterInspectionFailedV1Beta2Reason documents a failure when inspecting the status of the
52+
// etcd cluster hosted on KubeadmControlPlane controlled machines.
53+
KubeadmControlPlaneEtcdClusterInspectionFailedV1Beta2Reason = clusterv1.InspectionFailedV1Beta2Reason
54+
55+
// KubeadmControlPlaneEtcdClusterHealthyV1Beta2Reason surfaces when the etcd cluster hosted on KubeadmControlPlane
56+
// machines is healthy.
57+
KubeadmControlPlaneEtcdClusterHealthyV1Beta2Reason = "Healthy"
58+
59+
// KubeadmControlPlaneEtcdClusterNotHealthyV1Beta2Reason surfaces when the etcd cluster hosted on KubeadmControlPlane
60+
// machines is not healthy.
61+
KubeadmControlPlaneEtcdClusterNotHealthyV1Beta2Reason = "NotHealthy"
62+
63+
// KubeadmControlPlaneEtcdClusterHealthUnknownV1Beta2Reason surfaces when the health status of the etcd cluster hosted
64+
// on KubeadmControlPlane machines is unknown.
65+
KubeadmControlPlaneEtcdClusterHealthUnknownV1Beta2Reason = "HealthUnknown"
66+
)
67+
68+
// KubeadmControlPlane's ControlPlaneComponentsHealthy condition and corresponding reasons that will be used in v1Beta2 API version.
69+
const (
70+
// KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Condition surfaces issues to Kubernetes control plane components
71+
// hosted on machines managed by this object. It is computed as aggregation of Machine's `APIServerPodHealthy`,
72+
// `ControllerManagerPodHealthy`, `SchedulerPodHealthy`, `EtcdPodHealthy` conditions plus additional checks on
73+
// control plane machines and nodes.
74+
KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Condition = "ControlPlaneComponentsHealthy"
75+
76+
// KubeadmControlPlaneControlPlaneComponentsInspectionFailedV1Beta2Reason documents a failure when inspecting the status of the
77+
// control plane components hosted on KubeadmControlPlane controlled machines.
78+
KubeadmControlPlaneControlPlaneComponentsInspectionFailedV1Beta2Reason = clusterv1.InspectionFailedV1Beta2Reason
79+
80+
// KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Reason surfaces when the Kubernetes control plane components
81+
// hosted on KubeadmControlPlane machines are healthy.
82+
KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Reason = "Healthy"
83+
84+
// KubeadmControlPlaneControlPlaneComponentsNotHealthyV1Beta2Reason surfaces when the Kubernetes control plane components
85+
// hosted on KubeadmControlPlane machines are not healthy.
86+
KubeadmControlPlaneControlPlaneComponentsNotHealthyV1Beta2Reason = "NotHealthy"
87+
88+
// KubeadmControlPlaneControlPlaneComponentsHealthUnknownV1Beta2Reason surfaces when the health status of the
89+
// Kubernetes control plane components hosted on KubeadmControlPlane machines is unknown.
90+
KubeadmControlPlaneControlPlaneComponentsHealthUnknownV1Beta2Reason = "HealthUnknown"
4991
)
5092

5193
// KubeadmControlPlane's MachinesReady condition and corresponding reasons that will be used in v1Beta2 API version.
@@ -113,7 +155,8 @@ const (
113155
KubeadmControlPlanePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
114156
)
115157

116-
// Conditions that will be used for the KubeadmControlPlane controlled machines in v1Beta2 API version.
158+
// APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy and EtcdPodHealthy condition and corresponding
159+
// reasons that will be used for KubeadmControlPlane controlled machines in v1Beta2 API version.
117160
const (
118161
// KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition surfaces the status of the API server pod hosted on a KubeadmControlPlane controlled machine.
119162
KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition = "APIServerPodHealthy"
@@ -127,6 +170,50 @@ const (
127170
// KubeadmControlPlaneMachineEtcdPodHealthyV1Beta2Condition surfaces the status of the etcd pod hosted on a KubeadmControlPlane controlled machine.
128171
KubeadmControlPlaneMachineEtcdPodHealthyV1Beta2Condition = "EtcdPodHealthy"
129172

173+
// KubeadmControlPlaneMachinePodRunningV1Beta2Reason surfaces a pod hosted on a KubeadmControlPlane controlled machine that is running.
174+
KubeadmControlPlaneMachinePodRunningV1Beta2Reason = "Running"
175+
176+
// KubeadmControlPlaneMachinePodProvisioningV1Beta2Reason surfaces a pod hosted on a KubeadmControlPlane controlled machine
177+
// waiting to be provisioned i.e., Pod is in "Pending" phase.
178+
KubeadmControlPlaneMachinePodProvisioningV1Beta2Reason = "Provisioning"
179+
180+
// KubeadmControlPlaneMachinePodDoesNotExistV1Beta2Reason surfaces a when a pod hosted on a KubeadmControlPlane controlled machine
181+
// does not exist.
182+
KubeadmControlPlaneMachinePodDoesNotExistV1Beta2Reason = "DoesNotExist"
183+
184+
// KubeadmControlPlaneMachinePodFailedV1Beta2Reason surfaces a when a pod hosted on a KubeadmControlPlane controlled machine
185+
// failed during provisioning, e.g. CrashLoopBackOff, ImagePullBackOff or if all the containers in a pod have terminated.
186+
KubeadmControlPlaneMachinePodFailedV1Beta2Reason = "Failed"
187+
188+
// KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason documents a failure when inspecting the status of a
189+
// pod hosted on a KubeadmControlPlane controlled machine.
190+
KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason = clusterv1.InspectionFailedV1Beta2Reason
191+
192+
// KubeadmControlPlaneMachinePodDeletingV1Beta2Reason surfaces when the machine hosting control plane components
193+
// is being deleted.
194+
KubeadmControlPlaneMachinePodDeletingV1Beta2Reason = "Deleting"
195+
196+
// KubeadmControlPlaneMachinePodInternalErrorV1Beta2Reason surfaces unexpected failures when reading pod hosted
197+
// on a KubeadmControlPlane controlled machine.
198+
KubeadmControlPlaneMachinePodInternalErrorV1Beta2Reason = clusterv1.InternalErrorV1Beta2Reason
199+
)
200+
201+
// EtcdMemberHealthy condition and corresponding reasons that will be used for KubeadmControlPlane controlled machines in v1Beta2 API version.
202+
const (
130203
// KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition surfaces the status of the etcd member hosted on a KubeadmControlPlane controlled machine.
131-
KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition = "EtcdMemberHealthy"
204+
KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition = "Healthy"
205+
206+
// KubeadmControlPlaneMachineEtcdMemberNotHealthyV1Beta2Reason surfaces when the etcd member hosted on a KubeadmControlPlane controlled machine is not healthy.
207+
KubeadmControlPlaneMachineEtcdMemberNotHealthyV1Beta2Reason = "NotHealthy"
208+
209+
// KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Reason surfaces when the etcd member hosted on a KubeadmControlPlane controlled machine is healthy.
210+
KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Reason = "Healthy"
211+
212+
// KubeadmControlPlaneMachineEtcdMemberInspectionFailedV1Beta2Reason documents a failure when inspecting the status of an
213+
// etcd member hosted on a KubeadmControlPlane controlled machine.
214+
KubeadmControlPlaneMachineEtcdMemberInspectionFailedV1Beta2Reason = clusterv1.InspectionFailedV1Beta2Reason
215+
216+
// KubeadmControlPlaneMachineEtcdMemberDeletingV1Beta2Reason surfaces when the machine hosting an etcd member
217+
// is being deleted.
218+
KubeadmControlPlaneMachineEtcdMemberDeletingV1Beta2Reason = "Deleting"
132219
)

controlplane/kubeadm/internal/controllers/controller.go

+23-9
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,29 @@ func patchKubeadmControlPlane(ctx context.Context, patchHelper *patch.Helper, kc
317317
// Patch the object, ignoring conflicts on the conditions owned by this controller.
318318
// Also, if requested, we are adding additional options like e.g. Patch ObservedGeneration when issuing the
319319
// patch at the end of the reconcile loop.
320-
options = append(options, patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{
321-
controlplanev1.MachinesCreatedCondition,
322-
clusterv1.ReadyCondition,
323-
controlplanev1.MachinesSpecUpToDateCondition,
324-
controlplanev1.ResizedCondition,
325-
controlplanev1.MachinesReadyCondition,
326-
controlplanev1.AvailableCondition,
327-
controlplanev1.CertificatesAvailableCondition,
328-
}})
320+
options = append(options,
321+
patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{
322+
controlplanev1.MachinesCreatedCondition,
323+
clusterv1.ReadyCondition,
324+
controlplanev1.MachinesSpecUpToDateCondition,
325+
controlplanev1.ResizedCondition,
326+
controlplanev1.MachinesReadyCondition,
327+
controlplanev1.AvailableCondition,
328+
controlplanev1.CertificatesAvailableCondition,
329+
}},
330+
patch.WithOwnedV1Beta2Conditions{Conditions: []string{
331+
controlplanev1.KubeadmControlPlaneAvailableV1Beta2Condition,
332+
controlplanev1.KubeadmControlPlaneCertificatesAvailableV1Beta2Condition,
333+
controlplanev1.KubeadmControlPlaneEtcdClusterHealthyV1Beta2Condition,
334+
controlplanev1.KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Condition,
335+
controlplanev1.KubeadmControlPlaneMachinesReadyV1Beta2Condition,
336+
controlplanev1.KubeadmControlPlaneMachinesUpToDateV1Beta2Condition,
337+
controlplanev1.KubeadmControlPlaneScalingUpV1Beta2Condition,
338+
controlplanev1.KubeadmControlPlaneScalingDownV1Beta2Condition,
339+
controlplanev1.KubeadmControlPlaneRemediatingV1Beta2Condition,
340+
controlplanev1.KubeadmControlPlaneDeletingV1Beta2Condition,
341+
}},
342+
)
329343

330344
return patchHelper.Patch(ctx, kcp, options...)
331345
}

0 commit comments

Comments
 (0)