Skip to content

Commit a4c742d

Browse files
enxebreorenc1
authored andcommitted
bubble up KubeAPIServerAvailable and EtcdAvailable from HCP into HC
1 parent ee9e149 commit a4c742d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,44 @@ func (r *HostedClusterReconciler) reconcile(ctx context.Context, req ctrl.Reques
480480
meta.SetStatusCondition(&hcluster.Status.Conditions, *condition)
481481
}
482482

483+
// Copy the EtcdAvailable condition on the hostedcontrolplane.
484+
{
485+
condition := &metav1.Condition{
486+
Type: string(hyperv1.EtcdAvailable),
487+
Status: metav1.ConditionUnknown,
488+
Reason: hyperv1.StatusUnknownReason,
489+
Message: "The hosted control plane is not found",
490+
ObservedGeneration: hcluster.Generation,
491+
}
492+
if hcp != nil {
493+
etcdCondition := meta.FindStatusCondition(hcp.Status.Conditions, string(hyperv1.EtcdAvailable))
494+
if etcdCondition != nil {
495+
condition = etcdCondition
496+
}
497+
}
498+
condition.ObservedGeneration = hcluster.Generation
499+
meta.SetStatusCondition(&hcluster.Status.Conditions, *condition)
500+
}
501+
502+
// Copy the KubeAPIServerAvailable condition on the hostedcontrolplane.
503+
{
504+
condition := &metav1.Condition{
505+
Type: string(hyperv1.KubeAPIServerAvailable),
506+
Status: metav1.ConditionUnknown,
507+
Reason: hyperv1.StatusUnknownReason,
508+
Message: "The hosted control plane is not found",
509+
ObservedGeneration: hcluster.Generation,
510+
}
511+
if hcp != nil {
512+
etcdCondition := meta.FindStatusCondition(hcp.Status.Conditions, string(hyperv1.KubeAPIServerAvailable))
513+
if etcdCondition != nil {
514+
condition = etcdCondition
515+
}
516+
}
517+
condition.ObservedGeneration = hcluster.Generation
518+
meta.SetStatusCondition(&hcluster.Status.Conditions, *condition)
519+
}
520+
483521
// Copy the InfrastructureReady condition on the hostedcontrolplane.
484522
{
485523
condition := &metav1.Condition{

0 commit comments

Comments
 (0)