@@ -339,9 +339,11 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
339
339
340
340
if k8sutil .IsPodReady (pod ) && k8sutil .AreContainersReady (pod , coreContainers ) {
341
341
// Pod is now ready
342
- if anyOf (memberStatus .Conditions .Update (api .ConditionTypeReady , true , "Pod Ready" , "" ),
342
+ if util .Or (
343
+ memberStatus .Conditions .Update (api .ConditionTypeReady , true , "Pod Ready" , "" ),
343
344
memberStatus .Conditions .Update (api .ConditionTypeStarted , true , "Pod Started" , "" ),
344
- memberStatus .Conditions .Update (api .ConditionTypeServing , true , "Pod Serving" , "" )) {
345
+ memberStatus .Conditions .Update (api .ConditionTypeServing , true , "Pod Serving" , "" ),
346
+ ) {
345
347
log .Str ("pod-name" , pod .GetName ()).Debug ("Updating member condition Ready, Started & Serving to true" )
346
348
347
349
if status .Topology .IsTopologyOwned (memberStatus .Topology ) {
@@ -363,16 +365,20 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
363
365
}
364
366
} else if k8sutil .AreContainersReady (pod , coreContainers ) {
365
367
// Pod is not ready, but core containers are fine
366
- if anyOf (memberStatus .Conditions .Update (api .ConditionTypeReady , false , "Pod Not Ready" , "" ),
367
- memberStatus .Conditions .Update (api .ConditionTypeServing , true , "Pod is still serving" , "" )) {
368
+ if util .Or (
369
+ memberStatus .Conditions .Update (api .ConditionTypeReady , false , "Pod Not Ready" , "" ),
370
+ memberStatus .Conditions .Update (api .ConditionTypeServing , true , "Pod is still serving" , "" ),
371
+ ) {
368
372
log .Str ("pod-name" , pod .GetName ()).Debug ("Updating member condition Ready to false, while all core containers are ready" )
369
373
updateMemberStatusNeeded = true
370
374
nextInterval = nextInterval .ReduceTo (recheckSoonPodInspectorInterval )
371
375
}
372
376
} else {
373
377
// Pod is not ready
374
- if anyOf (memberStatus .Conditions .Update (api .ConditionTypeReady , false , "Pod Not Ready" , "" ),
375
- memberStatus .Conditions .Update (api .ConditionTypeServing , false , "Pod Core containers are not ready" , strings .Join (coreContainers , ", " ))) {
378
+ if util .Or (
379
+ memberStatus .Conditions .Update (api .ConditionTypeReady , false , "Pod Not Ready" , "" ),
380
+ memberStatus .Conditions .Update (api .ConditionTypeServing , false , "Pod Core containers are not ready" , strings .Join (coreContainers , ", " )),
381
+ ) {
376
382
log .Str ("pod-name" , pod .GetName ()).Debug ("Updating member condition Ready & Serving to false" )
377
383
updateMemberStatusNeeded = true
378
384
nextInterval = nextInterval .ReduceTo (recheckSoonPodInspectorInterval )
@@ -566,13 +572,3 @@ func removeLabel(labels map[string]string, key string) map[string]string {
566
572
567
573
return labels
568
574
}
569
-
570
- func anyOf (bools ... bool ) bool {
571
- for _ , b := range bools {
572
- if b {
573
- return true
574
- }
575
- }
576
-
577
- return false
578
- }
0 commit comments