Skip to content

Commit

Permalink
set condition messsage when waiting for kas readiness
Browse files Browse the repository at this point in the history
  • Loading branch information
sjenning committed Jul 28, 2022
1 parent 1e29e78 commit efb0790
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
11 changes: 6 additions & 5 deletions api/v1alpha1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1688,21 +1688,22 @@ const (
IgnitionServerDeploymentUnavailableReason = "IgnitionServerDeploymentUnavailable"

HostedClusterAsExpectedReason = "HostedClusterAsExpected"
HostedClusterUnhealthyComponentsReason = "UnhealthyControlPlaneComponents"
HostedClusterWaitingForAvailableReason = "HostedClusterWaitingForAvailable"
InvalidConfigurationReason = "InvalidConfiguration"

DeploymentNotFoundReason = "DeploymentNotFound"
DeploymentStatusUnknownReason = "DeploymentStatusUnknown"
DeploymentNotFoundReason = "DeploymentNotFound"
DeploymentStatusUnknownReason = "DeploymentStatusUnknown"
DeploymentWaitingForAvailableReason = "DeploymentWaitingForAvailable"

HostedControlPlaneComponentsUnavailableReason = "ComponentsUnavailable"
KubeconfigUnavailableReason = "KubeconfigUnavailable"
KubeconfigWaitingForCreateReason = "KubeconfigWaitingForCreate"
ClusterVersionStatusUnknownReason = "ClusterVersionStatusUnknown"

StatusUnknownReason = "StatusUnknown"
AsExpectedReason = "AsExpected"

EtcdQuorumAvailableReason = "QuorumAvailable"
EtcdQuorumUnavailableReason = "QuorumUnavailable"
EtcdWaitingForQuorumReason = "EtcdWaitingForQuorum"
EtcdStatusUnknownReason = "EtcdStatusUnknown"
EtcdStatefulSetNotFoundReason = "StatefulSetNotFound"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,21 @@ func (r *HostedControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
Reason: hyperv1.DeploymentStatusUnknownReason,
}
for _, cond := range deployment.Status.Conditions {
if cond.Type == appsv1.DeploymentAvailable && cond.Status == corev1.ConditionTrue {
newCondition = metav1.Condition{
Type: string(hyperv1.KubeAPIServerAvailable),
Status: metav1.ConditionTrue,
Reason: hyperv1.AsExpectedReason,
if cond.Type == appsv1.DeploymentAvailable {
if cond.Status == corev1.ConditionTrue {
newCondition = metav1.Condition{
Type: string(hyperv1.KubeAPIServerAvailable),
Status: metav1.ConditionTrue,
Reason: hyperv1.AsExpectedReason,
Message: "Kube APIServer deployment is available",
}
} else {
newCondition = metav1.Condition{
Type: string(hyperv1.KubeAPIServerAvailable),
Status: metav1.ConditionFalse,
Reason: hyperv1.DeploymentWaitingForAvailableReason,
Message: "Waiting for Kube APIServer deployment to become available",
}
}
break
}
Expand Down Expand Up @@ -401,8 +411,8 @@ func (r *HostedControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
reason = infrastructureCondition.Reason
message = infrastructureCondition.Message
case !kubeConfigAvailable:
reason = hyperv1.KubeconfigUnavailableReason
message = "The hosted control plane kubeconfig is not available"
reason = hyperv1.KubeconfigWaitingForCreateReason
message = "Waiting for hosted control plane kubeconfig to be created"
case etcdCondition != nil && etcdCondition.Status == metav1.ConditionFalse:
reason = etcdCondition.Reason
message = etcdCondition.Message
Expand Down Expand Up @@ -2554,12 +2564,12 @@ func (r *HostedControlPlaneReconciler) etcdStatefulSetCondition(ctx context.Cont
}

if len(message) == 0 {
message = "Etcd has not yet reached quorum"
message = "Waiting for etcd to reach quorum"
}
return &metav1.Condition{
Type: string(hyperv1.EtcdAvailable),
Status: metav1.ConditionFalse,
Reason: hyperv1.EtcdQuorumUnavailableReason,
Reason: hyperv1.EtcdWaitingForQuorumReason,
Message: message,
}, nil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3003,8 +3003,8 @@ func computeClusterVersionStatus(clock clock.WithTickerAndDelayedExecution, hclu
func computeHostedClusterAvailability(hcluster *hyperv1.HostedCluster, hcp *hyperv1.HostedControlPlane) metav1.Condition {
// Determine whether the hosted control plane is available.
hcpAvailableStatus := metav1.ConditionFalse
hcpAvailableMessage := "The hosted control plane is unavailable"
hcpAvailableReason := hyperv1.HostedClusterUnhealthyComponentsReason
hcpAvailableMessage := "Waiting for hosted control plane to be healthy"
hcpAvailableReason := hyperv1.HostedClusterWaitingForAvailableReason
var hcpAvailableCondition *metav1.Condition
if hcp != nil {
hcpAvailableCondition = meta.FindStatusCondition(hcp.Status.Conditions, string(hyperv1.HostedControlPlaneAvailable))
Expand Down

0 comments on commit efb0790

Please sign in to comment.