outposts: improve logging from k8s controller
This commit is contained in:
parent
3454760731
commit
6b1d30d230
|
@ -34,7 +34,7 @@ class BaseController:
|
||||||
"""Call .run() but capture all log output and return it."""
|
"""Call .run() but capture all log output and return it."""
|
||||||
with capture_logs() as logs:
|
with capture_logs() as logs:
|
||||||
self.run()
|
self.run()
|
||||||
return logs
|
return [f"{x['controller']}: {x['event']}" for x in logs]
|
||||||
|
|
||||||
def get_static_deployment(self) -> str:
|
def get_static_deployment(self) -> str:
|
||||||
"""Return a static deployment configuration"""
|
"""Return a static deployment configuration"""
|
||||||
|
|
|
@ -31,9 +31,7 @@ class KubernetesObjectReconciler(Generic[T]):
|
||||||
def __init__(self, outpost: Outpost):
|
def __init__(self, outpost: Outpost):
|
||||||
self.outpost = outpost
|
self.outpost = outpost
|
||||||
self.namespace = ""
|
self.namespace = ""
|
||||||
self.logger = get_logger(
|
self.logger = get_logger(controller=self.__class__.__name__, outpost=outpost)
|
||||||
component=f"k8s-reconciler-{self.__class__.__name__}", outpost=outpost
|
|
||||||
)
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Create object if it doesn't exist, update if needed or recreate if needed."""
|
"""Create object if it doesn't exist, update if needed or recreate if needed."""
|
||||||
|
|
Reference in New Issue