@@ -59,6 +59,12 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
5959 log .Error (err , "Failed to get Pod" )
6060 return ctrl.Result {}, err
6161 }
62+ // generate tensor fusion connections and apply to cluster
63+ tfConnection := generateTensorFusionConnection (pod )
64+ if tfConnection == nil {
65+ // not a tf pod skipped
66+ return ctrl.Result {}, nil
67+ }
6268
6369 if _ , ok := pod .Annotations [constants .TensorFusionEnabledReplicasAnnotation ]; ok {
6470 shouldReturn , err := utils .HandleFinalizer (ctx , pod , r .Client , func (context context.Context , pod * corev1.Pod ) (bool , error ) {
@@ -76,8 +82,6 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
7682 }
7783 }
7884
79- // generate tensor fusion connections and apply to cluster
80- tfConnection := generateTensorFusionConnection (pod )
8185 existConn := & tfv1.TensorFusionConnection {}
8286 if err := r .Get (ctx , types.NamespacedName {Name : tfConnection .Name , Namespace : tfConnection .Namespace }, existConn ); err != nil {
8387 if errors .IsNotFound (err ) {
@@ -96,6 +100,9 @@ func generateTensorFusionConnection(pod *corev1.Pod) *tfv1.TensorFusionConnectio
96100 return nil
97101 }
98102 nameNamespace := findConnectionNameNamespace (pod )
103+ if nameNamespace .Name == "" || nameNamespace .Namespace == "" {
104+ return nil
105+ }
99106 connection := & tfv1.TensorFusionConnection {
100107 ObjectMeta : metav1.ObjectMeta {
101108 Name : nameNamespace .Name ,
0 commit comments