From 919336a5190731cf05cb2102d4dd856899ad79bc Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 24 Sep 2021 23:45:15 +0200 Subject: [PATCH] outposts: ensure service is always re-created with mismatching ports Signed-off-by: Jens Langhammer --- authentik/outposts/controllers/k8s/service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/authentik/outposts/controllers/k8s/service.py b/authentik/outposts/controllers/k8s/service.py index 03a665c40..12b50c222 100644 --- a/authentik/outposts/controllers/k8s/service.py +++ b/authentik/outposts/controllers/k8s/service.py @@ -19,12 +19,16 @@ class ServiceReconciler(KubernetesObjectReconciler[V1Service]): self.api = CoreV1Api(controller.client) def reconcile(self, current: V1Service, reference: V1Service): - super().reconcile(current, reference) if len(current.spec.ports) != len(reference.spec.ports): raise NeedsRecreate() for port in reference.spec.ports: if port not in current.spec.ports: raise NeedsRecreate() + # run the base reconcile last, as that will probably raise NeedsUpdate + # 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. + super().reconcile(current, reference) def get_reference_object(self) -> V1Service: """Get deployment object for outpost"""