@@ -110,7 +110,11 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
110110 ObjectMeta : metav1.ObjectMeta {
111111 Name : node .Name ,
112112 },
113- }); err != nil && ! errors .IsNotFound (err ) {
113+ }); err != nil {
114+ // requeue if the gpunode is not generated
115+ if errors .IsNotFound (err ) {
116+ return ctrl.Result {RequeueAfter : constants .PendingRequeueDuration }, nil
117+ }
114118 return ctrl.Result {}, fmt .Errorf ("can not delete gpuNode(%s) : %w" , node .Name , err )
115119 }
116120 return ctrl.Result {}, nil
@@ -121,9 +125,8 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
121125 if err := r .Client .Get (ctx , client.ObjectKey {Name : node .Name }, gpuNode ); err != nil {
122126 if errors .IsNotFound (err ) {
123127 gpuNode = r .generateGPUNode (node , pool )
124- _ , e := controllerutil .CreateOrUpdate (ctx , r .Client , gpuNode , func () error { return nil })
125- if e != nil {
126- return ctrl.Result {}, fmt .Errorf ("failed to create or patch GPUNode: %w" , e )
128+ if e := r .Client .Create (ctx , gpuNode ); e != nil {
129+ return ctrl.Result {}, fmt .Errorf ("failed to create GPUNode: %w" , e )
127130 }
128131 }
129132 } else {
0 commit comments