Ignore headless services in NP code

Seems like we need special handling of headless services in NP code that
is to ignore them if they have "None" string as a clusterIP.

Change-Id: Ie0fddae10ebddf97e78af85d372317861749d51d
Closes-Bug: 1914377
This commit is contained in:
Michał Dulko 2021-02-03 10:15:56 +01:00
parent 28b315ecd0
commit 1473cfc3f2
1 changed files with 2 additions and 1 deletions

View File

@ -581,7 +581,8 @@ class NetworkPolicyDriver(base.NetworkPolicyDriver):
if ns_name != resource['metadata']['name']:
continue
cluster_ip = service['spec'].get('clusterIP')
if not cluster_ip:
if not cluster_ip or cluster_ip == 'None':
# Headless services has 'None' as clusterIP.
continue
rule = driver_utils.create_security_group_rule_body(
'egress', port, protocol=protocol,