@@ -244,7 +244,10 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r
244244 var node corev1.Node
245245 err = r .Get (ctx , types.NamespacedName {Name : nodeName }, & node )
246246 if err != nil {
247- return reconcile.Result {}, fmt .Errorf ("obtaining node %s: %w" , nodeName , err )
247+ if ! errors .IsNotFound (err ) {
248+ log .WithError (err ).Error ("obtaining node" )
249+ }
250+ return reconcile.Result {}, client .IgnoreNotFound (err )
248251 }
249252
250253 if isNodeTaintExists (taintKey , node ) != healthy {
@@ -371,22 +374,32 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req reconcile.Request) (
371374 if err != nil {
372375 return reconcile.Result {}, fmt .Errorf ("listing pods: %w" , err )
373376 }
377+ err = updateNodeLabel (node .Name , r .Client )
378+ if err != nil {
379+ log .WithError (err ).WithField ("node" , node .Name ).Error ("failed to initialize labels on node" )
380+ }
374381 isWsdaemonTaintExists := isNodeTaintExists (wsDaemonTaintKey , node )
375382 isRegistryFacadeTaintExists := isNodeTaintExists (registryFacadeTaintKey , node )
376383 isWsDaemonReady , isRegistryFacadeReady := false , false
377384 for _ , pod := range podList .Items {
378385 if strings .HasPrefix (pod .Name , wsDaemon ) {
379- isWsDaemonReady = IsPodReady (pod )
386+ isWsDaemonReady , err = checkPodHealth (pod )
387+ if err != nil {
388+ log .WithError (err ).Error ("checking pod health" )
389+ }
380390 }
381391 if strings .HasPrefix (pod .Name , registryFacade ) {
382- isRegistryFacadeReady = IsPodReady (pod )
392+ isRegistryFacadeReady , err = checkPodHealth (pod )
393+ if err != nil {
394+ log .WithError (err ).Error ("checking pod health" )
395+ }
383396 }
384397 }
385398 if isWsDaemonReady == isWsdaemonTaintExists {
386- updateNodeTaint (wsDaemonTaintKey , isWsDaemonReady , node .Name , r )
399+ updateNodeTaint (wsDaemonTaintKey , ! isWsDaemonReady , node .Name , r )
387400 }
388401 if isRegistryFacadeReady == isRegistryFacadeTaintExists {
389- updateNodeTaint (registryFacadeTaintKey , isRegistryFacadeReady , node .Name , r )
402+ updateNodeTaint (registryFacadeTaintKey , ! isRegistryFacadeReady , node .Name , r )
390403 }
391404 return reconcile.Result {}, nil
392405}
0 commit comments