outposts: fix service reconciler re-creating services
closes #2095 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
3f609b8601
commit
f44cf06d22
|
@ -16,13 +16,22 @@ def get_namespace() -> str:
|
||||||
return "default"
|
return "default"
|
||||||
|
|
||||||
|
|
||||||
|
def compare_port(current: V1ServicePort, reference: V1ServicePort) -> bool:
|
||||||
|
"""Compare a single port"""
|
||||||
|
if current.name != reference.name:
|
||||||
|
return False
|
||||||
|
# We only care about the target port
|
||||||
|
if current.target_port != reference.target_port:
|
||||||
|
return False
|
||||||
|
if current.protocol != reference.protocol:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def compare_ports(current: list[V1ServicePort], reference: list[V1ServicePort]):
|
def compare_ports(current: list[V1ServicePort], reference: list[V1ServicePort]):
|
||||||
"""Compare ports of a list"""
|
"""Compare ports of a list"""
|
||||||
if len(current) != len(reference):
|
if len(current) != len(reference):
|
||||||
raise NeedsRecreate()
|
raise NeedsRecreate()
|
||||||
for port in reference:
|
for port in reference:
|
||||||
# We don't need to compare node_ports
|
if not any(compare_port(port, current_port) for current_port in current):
|
||||||
# https://github.com/goauthentik/authentik/issues/2095#issuecomment-1020674326
|
|
||||||
port.node_port = None
|
|
||||||
if port not in current:
|
|
||||||
raise NeedsRecreate()
|
raise NeedsRecreate()
|
||||||
|
|
Reference in New Issue