GetPodsNotOnPrimaryNode filters out only pods that are not on the same node as the primary one
( status postgres.PostgresqlStatusList, primaryPod *postgres.PostgresqlStatus, )
| 393 | |
| 394 | // GetPodsNotOnPrimaryNode filters out only pods that are not on the same node as the primary one |
| 395 | func GetPodsNotOnPrimaryNode( |
| 396 | status postgres.PostgresqlStatusList, |
| 397 | primaryPod *postgres.PostgresqlStatus, |
| 398 | ) postgres.PostgresqlStatusList { |
| 399 | podsOnOtherNodes := postgres.PostgresqlStatusList{ |
| 400 | IsReplicaCluster: status.IsReplicaCluster, |
| 401 | CurrentPrimary: status.CurrentPrimary, |
| 402 | } |
| 403 | if primaryPod == nil { |
| 404 | return podsOnOtherNodes |
| 405 | } |
| 406 | for _, candidate := range status.Items { |
| 407 | if candidate.Pod.Name != primaryPod.Pod.Name && candidate.Node != primaryPod.Node { |
| 408 | podsOnOtherNodes.Items = append(podsOnOtherNodes.Items, candidate) |
| 409 | } |
| 410 | } |
| 411 | return podsOnOtherNodes |
| 412 | } |
| 413 | |
| 414 | // If the cluster is not in the online upgrading phase, enforceFailoverDelay will evaluate the failover delay specified |
| 415 | // in the cluster's specification. |
no outgoing calls
no test coverage detected