Skip to content

🌱 Refine KCP's Available, ControlPlaneComponentsHealthy, EtcdClusterHealthy v1beta2 conditions #11504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions controlplane/kubeadm/internal/controllers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,7 @@ func TestKubeadmControlPlaneReconciler_reconcileControlPlaneAndMachinesCondition
},
Spec: clusterv1.MachineSpec{
Version: ptr.To("v1.31.0"),
ProviderID: ptr.To("foo"),
InfrastructureRef: corev1.ObjectReference{Kind: "GenericInfrastructureMachine", APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1", Name: "m1"},
},
}
Expand Down Expand Up @@ -2012,46 +2013,46 @@ func TestKubeadmControlPlaneReconciler_reconcileControlPlaneAndMachinesCondition
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneEtcdClusterHealthUnknownV1Beta2Reason,
Message: "* Machine machine1-test:\n" +
" * EtcdMemberHealthy: Waiting for GenericInfrastructureMachine to report spec.providerID",
" * EtcdMemberHealthy: Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneControlPlaneComponentsHealthUnknownV1Beta2Reason,
Message: "* Machine machine1-test:\n" +
" * Control plane components: Waiting for GenericInfrastructureMachine to report spec.providerID",
" * Control plane components: Waiting for a Node with spec.providerID foo to exist",
},
},
expectMachineConditions: []metav1.Condition{
{
Type: controlplanev1.KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineControllerManagerPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineSchedulerPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineEtcdPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachineEtcdMemberInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Expand Down Expand Up @@ -2089,46 +2090,46 @@ func TestKubeadmControlPlaneReconciler_reconcileControlPlaneAndMachinesCondition
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneEtcdClusterHealthUnknownV1Beta2Reason,
Message: "* Machine machine1-test:\n" +
" * EtcdMemberHealthy: Waiting for GenericInfrastructureMachine to report spec.providerID",
" * EtcdMemberHealthy: Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneControlPlaneComponentsHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneControlPlaneComponentsHealthUnknownV1Beta2Reason,
Message: "* Machine machine1-test:\n" +
" * Control plane components: Waiting for GenericInfrastructureMachine to report spec.providerID",
" * Control plane components: Waiting for a Node with spec.providerID foo to exist",
},
},
expectMachineConditions: []metav1.Condition{
{
Type: controlplanev1.KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineControllerManagerPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineSchedulerPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineEtcdPodHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachinePodInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: controlplanev1.KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: controlplanev1.KubeadmControlPlaneMachineEtcdMemberInspectionFailedV1Beta2Reason,
Message: "Waiting for GenericInfrastructureMachine to report spec.providerID",
Message: "Waiting for a Node with spec.providerID foo to exist",
},
{
Type: clusterv1.MachineUpToDateV1Beta2Condition,
Expand Down
8 changes: 8 additions & 0 deletions controlplane/kubeadm/internal/controllers/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ func setAvailableCondition(_ context.Context, kcp *controlplanev1.KubeadmControl
k8sControlPlaneNotHealthyButNotReportedYet := 0

for _, machine := range machines {
// Ignore machines without a provider ID yet (which also implies infrastructure not ready).
// Note: this avoids some noise when a new machine is provisioning; it is not possible to delay further
// because the etcd member might join the cluster / control plane components might start even before
// kubelet registers the node to the API server (e.g. in case kubelet has issues to register itself).
if machine.Spec.ProviderID == nil {
continue
}

// if external etcd, only look at the status of the K8s control plane components on this machine.
if !etcdIsManaged {
if v1beta2conditions.IsTrue(machine, controlplanev1.KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition) &&
Expand Down
Loading