Skip to content

Commit 3f68a69

Browse files
committed
report ksvc status
1 parent 7cce126 commit 3f68a69

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pkg/reconciler/functions/functions.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,17 @@ func (r *Reconciler) reconcile(ctx context.Context, fn *duckv1alpha1.Function) e
145145
return err
146146
}
147147

148-
_, err = r.reconcileService(ctx, fn, cm)
148+
svc, err := r.reconcileService(ctx, fn, cm)
149149
if err != nil {
150150
fn.Status.MarkServiceNotSynced("CheckExistFailed", err.Error())
151151
return err
152152
}
153153

154+
err = r.propagateServiceStatusIfError(ctx, fn, svc)
155+
if err != nil {
156+
return err
157+
}
158+
154159
// Add new route
155160

156161
route, err := r.reconcileRoute(ctx, fn)
@@ -357,6 +362,19 @@ func (r *Reconciler) reconcileService(ctx context.Context, fn *duckv1alpha1.Func
357362
return service, nil
358363
}
359364

365+
func (r *Reconciler) propagateServiceStatusIfError(ctx context.Context, fn *duckv1alpha1.Function, service *servingv1beta1.Service) error {
366+
c := service.Status.GetCondition(servingv1beta1.ServiceConditionReady)
367+
if c == nil || c.Status != corev1.ConditionTrue {
368+
if c == nil {
369+
fn.Status.MarkServiceNotSynced("Unknown", "")
370+
} else {
371+
fn.Status.MarkServiceNotSynced(c.Reason, c.Message)
372+
}
373+
return fmt.Errorf("service %s is not ready", service.Name)
374+
}
375+
return nil
376+
}
377+
360378
// Update the Status of the resource. Caller is responsible for checking
361379
// for semantic differences before calling.
362380
func (r *Reconciler) updateStatus(desired *duckv1alpha1.Function) (*unstructured.Unstructured, error) {

0 commit comments

Comments
 (0)