Fix value ValueError when Pod has no IP address

In case the Pod has no IP address we shouldn't attempt to
convert it to a Python address. Instead, we should skip that
operation and expect it to be retried later.

Change-Id: I1eb9c2f51fd792405cbb87742645518a00fdc890
This commit is contained in:
Maysa Macedo 2023-04-14 13:53:26 +02:00
parent 9cd15b6d37
commit 2b69e039a8

View File

@ -637,6 +637,8 @@ class NetworkPolicyDriver(base.NetworkPolicyDriver):
def _pods_in_ip_block(self, pods, resource):
for pod in pods:
pod_ip = driver_utils.get_pod_ip(pod)
if pod_ip is None:
continue
if (ipaddress.ip_address(pod_ip)
in ipaddress.ip_network(resource.get('cidr'))):
return True