@@ -339,9 +339,11 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
339339
340340 if k8sutil .IsPodReady (pod ) && k8sutil .AreContainersReady (pod , coreContainers ) {
341341 // 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" , "" ),
343344 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+ ) {
345347 log .Str ("pod-name" , pod .GetName ()).Debug ("Updating member condition Ready, Started & Serving to true" )
346348
347349 if status .Topology .IsTopologyOwned (memberStatus .Topology ) {
@@ -363,16 +365,20 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
363365 }
364366 } else if k8sutil .AreContainersReady (pod , coreContainers ) {
365367 // 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+ ) {
368372 log .Str ("pod-name" , pod .GetName ()).Debug ("Updating member condition Ready to false, while all core containers are ready" )
369373 updateMemberStatusNeeded = true
370374 nextInterval = nextInterval .ReduceTo (recheckSoonPodInspectorInterval )
371375 }
372376 } else {
373377 // 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+ ) {
376382 log .Str ("pod-name" , pod .GetName ()).Debug ("Updating member condition Ready & Serving to false" )
377383 updateMemberStatusNeeded = true
378384 nextInterval = nextInterval .ReduceTo (recheckSoonPodInspectorInterval )
@@ -566,13 +572,3 @@ func removeLabel(labels map[string]string, key string) map[string]string {
566572
567573 return labels
568574}
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