@@ -244,7 +244,10 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r
244
244
var node corev1.Node
245
245
err = r .Get (ctx , types.NamespacedName {Name : nodeName }, & node )
246
246
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 )
248
251
}
249
252
250
253
if isNodeTaintExists (taintKey , node ) != healthy {
@@ -371,22 +374,32 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req reconcile.Request) (
371
374
if err != nil {
372
375
return reconcile.Result {}, fmt .Errorf ("listing pods: %w" , err )
373
376
}
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
+ }
374
381
isWsdaemonTaintExists := isNodeTaintExists (wsDaemonTaintKey , node )
375
382
isRegistryFacadeTaintExists := isNodeTaintExists (registryFacadeTaintKey , node )
376
383
isWsDaemonReady , isRegistryFacadeReady := false , false
377
384
for _ , pod := range podList .Items {
378
385
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
+ }
380
390
}
381
391
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
+ }
383
396
}
384
397
}
385
398
if isWsDaemonReady == isWsdaemonTaintExists {
386
- updateNodeTaint (wsDaemonTaintKey , isWsDaemonReady , node .Name , r )
399
+ updateNodeTaint (wsDaemonTaintKey , ! isWsDaemonReady , node .Name , r )
387
400
}
388
401
if isRegistryFacadeReady == isRegistryFacadeTaintExists {
389
- updateNodeTaint (registryFacadeTaintKey , isRegistryFacadeReady , node .Name , r )
402
+ updateNodeTaint (registryFacadeTaintKey , ! isRegistryFacadeReady , node .Name , r )
390
403
}
391
404
return reconcile.Result {}, nil
392
405
}
0 commit comments