diff --git a/controllers/controller/devworkspacerouting/devworkspacerouting_controller.go b/controllers/controller/devworkspacerouting/devworkspacerouting_controller.go index 6e93eb17e..42cafac06 100644 --- a/controllers/controller/devworkspacerouting/devworkspacerouting_controller.go +++ b/controllers/controller/devworkspacerouting/devworkspacerouting_controller.go @@ -26,6 +26,7 @@ import ( "github.com/devfile/devworkspace-operator/pkg/config" "github.com/devfile/devworkspace-operator/pkg/constants" "github.com/devfile/devworkspace-operator/pkg/infrastructure" + "github.com/devfile/devworkspace-operator/pkg/provision/sync" "github.com/go-logr/logr" "github.com/google/go-cmp/cmp" @@ -185,6 +186,10 @@ func (r *DevWorkspaceRoutingReconciler) Reconcile(ctx context.Context, req ctrl. servicesInSync, clusterServices, err := r.syncServices(instance, services) if err != nil { + failError := &sync.UnrecoverableSyncError{} + if errors.As(err, &failError) { + return reconcile.Result{}, r.markRoutingFailed(instance, err.Error()) + } reqLogger.Error(err, "Error syncing services") return reconcile.Result{Requeue: true}, r.reconcileStatus(instance, nil, nil, false, "Preparing services") } else if !servicesInSync { @@ -199,6 +204,10 @@ func (r *DevWorkspaceRoutingReconciler) Reconcile(ctx context.Context, req ctrl. if infrastructure.IsOpenShift() { routesInSync, clusterRoutes, err := r.syncRoutes(instance, routes) if err != nil { + failError := &sync.UnrecoverableSyncError{} + if errors.As(err, &failError) { + return reconcile.Result{}, r.markRoutingFailed(instance, err.Error()) + } reqLogger.Error(err, "Error syncing routes") return reconcile.Result{Requeue: true}, r.reconcileStatus(instance, nil, nil, false, "Preparing routes") } else if !routesInSync { @@ -209,6 +218,10 @@ func (r *DevWorkspaceRoutingReconciler) Reconcile(ctx context.Context, req ctrl. } else { ingressesInSync, clusterIngresses, err := r.syncIngresses(instance, ingresses) if err != nil { + failError := &sync.UnrecoverableSyncError{} + if errors.As(err, &failError) { + return reconcile.Result{}, r.markRoutingFailed(instance, err.Error()) + } reqLogger.Error(err, "Error syncing ingresses") return reconcile.Result{Requeue: true}, r.reconcileStatus(instance, nil, nil, false, "Preparing ingresses") } else if !ingressesInSync { diff --git a/controllers/controller/devworkspacerouting/sync_ingresses.go b/controllers/controller/devworkspacerouting/sync_ingresses.go index c42cc9f86..08936ce55 100644 --- a/controllers/controller/devworkspacerouting/sync_ingresses.go +++ b/controllers/controller/devworkspacerouting/sync_ingresses.go @@ -63,7 +63,7 @@ func (r *DevWorkspaceRoutingReconciler) syncIngresses(routing *controllerv1alpha ingressesInSync = false continue case *sync.UnrecoverableSyncError: - return false, nil, t.Cause + return false, nil, t default: return false, nil, err } diff --git a/controllers/controller/devworkspacerouting/sync_routes.go b/controllers/controller/devworkspacerouting/sync_routes.go index 18a2bf90e..d47d87617 100644 --- a/controllers/controller/devworkspacerouting/sync_routes.go +++ b/controllers/controller/devworkspacerouting/sync_routes.go @@ -62,7 +62,7 @@ func (r *DevWorkspaceRoutingReconciler) syncRoutes(routing *controllerv1alpha1.D routesInSync = false continue case *sync.UnrecoverableSyncError: - return false, nil, t.Cause + return false, nil, t default: return false, nil, err } diff --git a/controllers/controller/devworkspacerouting/sync_services.go b/controllers/controller/devworkspacerouting/sync_services.go index 32878c9ab..ac2a5d39b 100644 --- a/controllers/controller/devworkspacerouting/sync_services.go +++ b/controllers/controller/devworkspacerouting/sync_services.go @@ -62,7 +62,7 @@ func (r *DevWorkspaceRoutingReconciler) syncServices(routing *controllerv1alpha1 servicesInSync = false continue case *sync.UnrecoverableSyncError: - return false, nil, t.Cause + return false, nil, t default: return false, nil, err }