@@ -117,15 +117,15 @@ func (r *TensorFusionConnectionReconciler) Reconcile(ctx context.Context, req ct
117117 }
118118
119119 // Start worker job
120- phase , err := r .tryStartWorker (ctx , connection , types.NamespacedName {Name : connection .Name , Namespace : connection .Namespace })
120+ workerPod , err := r .tryStartWorker (ctx , connection , types.NamespacedName {Name : connection .Name , Namespace : connection .Namespace })
121121 if err != nil {
122122 log .Error (err , "Failed to start worker pod" )
123123 return ctrl.Result {}, err
124124 }
125125
126- if phase == corev1 .PodRunning {
126+ if workerPod . Status . Phase == corev1 .PodRunning {
127127 connection .Status .Phase = tfv1 .TensorFusionConnectionRunning
128- connection .Status .ConnectionURL = r .WorkerGenerator .GenerateConnectionURL (gpu , connection )
128+ connection .Status .ConnectionURL = r .WorkerGenerator .GenerateConnectionURL (gpu , connection , workerPod )
129129 }
130130 // TODO: Handle PodFailure
131131
@@ -141,23 +141,23 @@ func (r *TensorFusionConnectionReconciler) Reconcile(ctx context.Context, req ct
141141 return ctrl.Result {}, nil
142142}
143143
144- func (r * TensorFusionConnectionReconciler ) tryStartWorker (ctx context.Context , connection * tfv1.TensorFusionConnection , namespacedName types.NamespacedName ) (corev1.PodPhase , error ) {
144+ func (r * TensorFusionConnectionReconciler ) tryStartWorker (ctx context.Context , connection * tfv1.TensorFusionConnection , namespacedName types.NamespacedName ) (* corev1.Pod , error ) {
145145 // Try to get the Pod
146146 pod := & corev1.Pod {}
147147 if err := r .Get (ctx , namespacedName , pod ); err != nil {
148148 if errors .IsNotFound (err ) {
149149 // Pod doesn't exist, create a new one
150150 pod = r .WorkerGenerator .GenerateWorkerPod (connection , namespacedName )
151151 if err := ctrl .SetControllerReference (connection , pod , r .Scheme ); err != nil {
152- return "" , fmt .Errorf ("set owner reference %w" , err )
152+ return nil , fmt .Errorf ("set owner reference %w" , err )
153153 }
154154 if err := r .Create (ctx , pod ); err != nil {
155- return "" , fmt .Errorf ("create pod %w" , err )
155+ return nil , fmt .Errorf ("create pod %w" , err )
156156 }
157- return corev1 . PodPending , nil
157+ return pod , nil
158158 }
159159 }
160- return pod . Status . Phase , nil
160+ return pod , nil
161161}
162162
163163// handleDeletion handles cleanup of external dependencies
0 commit comments