From 6ed78830a01c71bcb06d230bbee360bd412c18de Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 2 Jan 2021 01:08:22 +0100 Subject: [PATCH] providers/proxy: check ingress annotations we manage --- authentik/providers/proxy/controllers/k8s/ingress.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/authentik/providers/proxy/controllers/k8s/ingress.py b/authentik/providers/proxy/controllers/k8s/ingress.py index 72adfdb03..94be2a04c 100644 --- a/authentik/providers/proxy/controllers/k8s/ingress.py +++ b/authentik/providers/proxy/controllers/k8s/ingress.py @@ -37,10 +37,19 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]): def name(self) -> str: return f"authentik-outpost-{self.controller.outpost.uuid.hex}" + def _check_annotations(self, reference: NetworkingV1beta1Ingress): + """Check that all annotations *we* set are correct""" + for key, value in self.get_ingress_annotations().items(): + if key not in reference.metadata.annotations: + raise NeedsUpdate() + if reference.metadata.annotations[key] != value: + raise NeedsUpdate() + def reconcile( self, current: NetworkingV1beta1Ingress, reference: NetworkingV1beta1Ingress ): super().reconcile(current, reference) + self._check_annotations(reference) # Create a list of all expected host and tls hosts expected_hosts = [] expected_hosts_tls = []