outposts: improve logging for outpost controller

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-09 12:34:44 +02:00
parent 2f88c435fb
commit 8c0a87b710
4 changed files with 6 additions and 4 deletions

View File

@ -71,7 +71,6 @@ class KubernetesObjectReconciler(Generic[T]):
self.logger.debug("Other unhandled error", exc=exc)
raise exc
else:
self.logger.debug("Got current, running reconcile")
self.reconcile(current, reference)
except NeedsRecreate:
self.logger.debug("Recreate requested")
@ -86,7 +85,7 @@ class KubernetesObjectReconciler(Generic[T]):
self.logger.debug("Updating")
self.update(current, reference)
else:
self.logger.debug("Nothing to do...")
self.logger.debug("Object is up-to-date.")
def down(self):
"""Delete object if found"""

View File

@ -123,6 +123,7 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]):
)
rules.append(rule)
if not rules:
self.logger.debug("No providers use proxying, no ingress needed")
raise Disabled()
tls_config = None
if tls_hosts:

View File

@ -91,8 +91,10 @@ class TraefikMiddlewareReconciler(KubernetesObjectReconciler[TraefikMiddleware])
outpost__in=[self.controller.outpost],
forward_auth_mode=True,
).exists():
self.logger.debug("No providers with forward auth enabled.")
raise Disabled()
if not self._crd_exists():
self.logger.debug("CRD doesn't exist")
raise Disabled()
return TraefikMiddleware(
apiVersion=f"{CRD_GROUP}/{CRD_VERSION}",

View File

@ -18,6 +18,6 @@ class ProxyKubernetesController(KubernetesController):
DeploymentPort(4443, "https", "tcp"),
]
self.reconcilers["ingress"] = IngressReconciler
self.reconcilers["traefik_middleware"] = TraefikMiddlewareReconciler
self.reconcilers["traefik middleware"] = TraefikMiddlewareReconciler
self.reconcile_order.append("ingress")
self.reconcile_order.append("traefik_middleware")
self.reconcile_order.append("traefik middleware")