Skip to content

Commit

Permalink
outposts: remove node_port on V1ServicePort checks to prevent service…
Browse files Browse the repository at this point in the history
… creation loops

Signed-off-by: Jens Langhammer <[email protected]>

goauthentik#2095
  • Loading branch information
BeryJu committed Feb 7, 2022
1 parent e758995 commit c87f6cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"totp",
"webauthn",
"traefik",
"passwordless"
"passwordless",
"kubernetes"
],
"python.linting.pylintEnabled": true,
"todo-tree.tree.showCountsInTree": true,
Expand Down
7 changes: 5 additions & 2 deletions authentik/outposts/controllers/k8s/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""k8s utils"""
from pathlib import Path

from kubernetes.client.models.v1_container_port import V1ContainerPort
from kubernetes.client.models.v1_service_port import V1ServicePort
from kubernetes.config.incluster_config import SERVICE_TOKEN_FILENAME

from authentik.outposts.controllers.k8s.triggers import NeedsRecreate
Expand All @@ -16,10 +16,13 @@ def get_namespace() -> str:
return "default"


def compare_ports(current: list[V1ContainerPort], reference: list[V1ContainerPort]):
def compare_ports(current: list[V1ServicePort], reference: list[V1ServicePort]):
"""Compare ports of a list"""
if len(current) != len(reference):
raise NeedsRecreate()
for port in reference:
# We don't need to compare node_ports
# https://github.com/goauthentik/authentik/issues/2095#issuecomment-1020674326
port.node_port = None
if port not in current:
raise NeedsRecreate()

0 comments on commit c87f6cd

Please sign in to comment.