From 18ff803370c735439602a70a07318706a3ae96eb Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 14 Jan 2022 11:42:57 +0100 Subject: [PATCH] outposts: trigger service update on k8s when selector doesnt match Signed-off-by: Jens Langhammer --- authentik/outposts/controllers/k8s/service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/authentik/outposts/controllers/k8s/service.py b/authentik/outposts/controllers/k8s/service.py index 0d04ffb89..dc32d291a 100644 --- a/authentik/outposts/controllers/k8s/service.py +++ b/authentik/outposts/controllers/k8s/service.py @@ -6,6 +6,7 @@ from kubernetes.client import CoreV1Api, V1Service, V1ServicePort, V1ServiceSpec from authentik.outposts.controllers.base import FIELD_MANAGER from authentik.outposts.controllers.k8s.base import KubernetesObjectReconciler from authentik.outposts.controllers.k8s.deployment import DeploymentReconciler +from authentik.outposts.controllers.k8s.triggers import NeedsUpdate from authentik.outposts.controllers.k8s.utils import compare_ports if TYPE_CHECKING: @@ -25,6 +26,8 @@ class ServiceReconciler(KubernetesObjectReconciler[V1Service]): # after an authentik update. However the ports might have also changed during # the update, so this causes the service to be re-created with higher # priority than being updated. + if current.spec.selector != reference.spec.selector: + raise NeedsUpdate() super().reconcile(current, reference) def get_reference_object(self) -> V1Service: