Merge "NP: Don't add pods without IP to affectedPods"
This commit is contained in:
commit
c5c1585b82
|
@ -69,6 +69,8 @@ class NetworkPolicyDriver(base.NetworkPolicyDriver):
|
|||
if 'remote_ip_prefixes' in rule:
|
||||
result['affectedPods'] = []
|
||||
for ip, namespace in rule['remote_ip_prefixes']:
|
||||
if not ip:
|
||||
continue
|
||||
result['affectedPods'].append({
|
||||
'podIP': ip,
|
||||
'podNamespace': namespace,
|
||||
|
|
|
@ -269,7 +269,7 @@ def create_security_group_rule_body(
|
|||
security_group_rule_body['namespace'] = namespace
|
||||
if pods:
|
||||
security_group_rule_body['affectedPods'] = [
|
||||
{'podIP': ip, 'podNamespace': ns} for ip, ns in pods.items()]
|
||||
{'podIP': ip, 'podNamespace': ns} for ip, ns in pods.items() if ip]
|
||||
LOG.debug("Creating sg rule body %s", security_group_rule_body)
|
||||
return security_group_rule_body
|
||||
|
||||
|
|
Loading…
Reference in New Issue