From 6b1d30d2309a2315190fea26eb8a2fe533284a96 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 16 Oct 2020 21:31:55 +0200 Subject: [PATCH] outposts: improve logging from k8s controller --- passbook/outposts/controllers/base.py | 2 +- passbook/outposts/controllers/k8s/base.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/passbook/outposts/controllers/base.py b/passbook/outposts/controllers/base.py index cc315ddb0..4821ac83c 100644 --- a/passbook/outposts/controllers/base.py +++ b/passbook/outposts/controllers/base.py @@ -34,7 +34,7 @@ class BaseController: """Call .run() but capture all log output and return it.""" with capture_logs() as logs: self.run() - return logs + return [f"{x['controller']}: {x['event']}" for x in logs] def get_static_deployment(self) -> str: """Return a static deployment configuration""" diff --git a/passbook/outposts/controllers/k8s/base.py b/passbook/outposts/controllers/k8s/base.py index a2b6a5c04..50b236fda 100644 --- a/passbook/outposts/controllers/k8s/base.py +++ b/passbook/outposts/controllers/k8s/base.py @@ -31,9 +31,7 @@ class KubernetesObjectReconciler(Generic[T]): def __init__(self, outpost: Outpost): self.outpost = outpost self.namespace = "" - self.logger = get_logger( - component=f"k8s-reconciler-{self.__class__.__name__}", outpost=outpost - ) + self.logger = get_logger(controller=self.__class__.__name__, outpost=outpost) def run(self): """Create object if it doesn't exist, update if needed or recreate if needed."""