Skip to content

Commit 264c984

Browse files
authored
Merge pull request #296 from Venkat-Kunaparaju/secondaryip-fix
Fix primary pod IP selection for shared secondary pods
2 parents 3bcb863 + 57a98fd commit 264c984

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

task.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,15 @@ def _network_type(self) -> str:
487487

488488
@property
489489
def uses_secondary_ip(self) -> bool:
490-
# MNP_PRIMARY_DENY is a SECONDARY pod, but its traffic still flows on the primary IP
490+
# MNP_PRIMARY_DENY stays on primary; SR-IOV with a NAD uses secondary IP
491+
has_configured_secondary_network = bool(
492+
self._get_node_secondary_network_nad()
493+
or self.ts.connection.secondary_network_nad
494+
)
491495
return (
492496
self._network_type == "secondary"
493497
and self.ts.connection_mode != ConnectionMode.MNP_PRIMARY_DENY
494-
)
498+
) or (self.pod_type == PodType.SRIOV and has_configured_secondary_network)
495499

496500
def render_pod_file(self, log_info: str) -> None:
497501
self.render_file(
@@ -621,10 +625,7 @@ def get_pod_ip(self) -> str:
621625
f"falling back to status.podIP"
622626
)
623627
pod_ip = y["status"]["podIP"]
624-
elif (
625-
self._get_node_secondary_network_nad()
626-
or self.ts.connection.secondary_network_nad
627-
):
628+
elif self.uses_secondary_ip:
628629
network_status_str = y["metadata"]["annotations"][
629630
"k8s.v1.cni.cncf.io/network-status"
630631
]

0 commit comments

Comments
 (0)