providers/proxy: check ingress annotations we manage

This commit is contained in:
Jens Langhammer 2021-01-02 01:08:22 +01:00
parent 6fe323f1a7
commit 6ed78830a0
1 changed files with 9 additions and 0 deletions

View File

@ -37,10 +37,19 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]):
def name(self) -> str: def name(self) -> str:
return f"authentik-outpost-{self.controller.outpost.uuid.hex}" 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( def reconcile(
self, current: NetworkingV1beta1Ingress, reference: NetworkingV1beta1Ingress self, current: NetworkingV1beta1Ingress, reference: NetworkingV1beta1Ingress
): ):
super().reconcile(current, reference) super().reconcile(current, reference)
self._check_annotations(reference)
# Create a list of all expected host and tls hosts # Create a list of all expected host and tls hosts
expected_hosts = [] expected_hosts = []
expected_hosts_tls = [] expected_hosts_tls = []