@@ -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.
362380func (r * Reconciler ) updateStatus (desired * duckv1alpha1.Function ) (* unstructured.Unstructured , error ) {
0 commit comments