Skip to content

Commit 4b03b17

Browse files
authored
Merge pull request #553 from application-stacks/kirby-knative-status
Add a check for the Knative Service's Ready status
2 parents 7460027 + 4b086e4 commit 4b03b17

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

utils/status.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,31 @@ func (r *ReconcilerBase) isKnativeReady(ba common.BaseComponent, c common.Status
185185

186186
msg, reason := "", ""
187187

188-
// Check if knative service exists
188+
// Check if the Knative Service exists
189189
if err := r.GetClient().Get(context.TODO(), namespacedName, knative); err != nil {
190-
msg, reason = "Knative service is not ready.", "NotCreated"
190+
msg, reason = "Knative Service is not ready.", "ServiceNotCreated"
191+
return c.SetConditionFields(msg, reason, corev1.ConditionFalse)
192+
}
193+
194+
// Check the Knative Service's status
195+
knativeReadyStatusFound := false
196+
for _, condition := range knative.Status.Conditions {
197+
if condition.Type == "Ready" {
198+
knativeReadyStatusFound = true
199+
if condition.Status != "True" {
200+
msg, reason = "Knative Service is not ready.", "ServiceNotReady"
201+
if len(condition.Message) > 0 {
202+
msg = "Knative Service is not ready; " + condition.Message
203+
}
204+
if len(condition.Reason) > 0 {
205+
reason = condition.Reason
206+
}
207+
return c.SetConditionFields(msg, reason, corev1.ConditionFalse)
208+
}
209+
}
210+
}
211+
if !knativeReadyStatusFound {
212+
msg, reason = "Knative Service is not ready; Waiting for the Service's status to appear.", "ServiceStatusNotFound"
191213
return c.SetConditionFields(msg, reason, corev1.ConditionFalse)
192214
}
193215

0 commit comments

Comments
 (0)