@@ -48,7 +48,38 @@ func (r *orcRouterInterfaceReconciler) Reconcile(ctx context.Context, req ctrl.R
4848 router := & orcv1alpha1.Router {}
4949 if err := r .client .Get (ctx , req .NamespacedName , router ); err != nil {
5050 if apierrors .IsNotFound (err ) {
51- return ctrl.Result {}, nil
51+ // The router does not exist (yet). We still need to update the status
52+ // on all RouterInterfaces that are associated with that router
53+
54+ // Creating a dummy router struct with namespace and name will be enough to
55+ // retrieve all defined RouterInterfaces for that to-be-created router
56+ router .Name = req .Name
57+ router .Namespace = req .Namespace
58+ routerInterfaces , err := routerDependency .GetObjectsForDependency (ctx , r .client , router )
59+
60+ if err != nil {
61+ return ctrl.Result {}, fmt .Errorf ("fetching router interfaces: %w" , err )
62+ }
63+
64+ if len (routerInterfaces ) == 0 {
65+ return ctrl.Result {}, nil
66+ }
67+
68+ var osResource * osclients.PortExt
69+
70+ var reconcileStatus progress.ReconcileStatus
71+ for i := range routerInterfaces {
72+ routerInterface := & routerInterfaces [i ]
73+ log = log .WithValues ("name" , routerInterface .Name )
74+
75+ var ifReconcileStatus progress.ReconcileStatus
76+ ifReconcileStatus = progress .WaitingOnObject ("Router" , req .Name , progress .WaitingOnCreation )
77+ ifReconcileStatus = ifReconcileStatus .WithReconcileStatus (r .updateStatus (ctx , routerInterface , osResource , ifReconcileStatus ))
78+
79+ reconcileStatus = reconcileStatus .WithReconcileStatus (ifReconcileStatus )
80+ }
81+
82+ return reconcileStatus .Return (log )
5283 }
5384 return ctrl.Result {}, err
5485 }
0 commit comments