-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Some shutdown logs are not in JSON format #4817
Description
Describe the bug
Some shutdown logs are not in JSON format, while most logs adhere to JSON. This breaks expectations for log parsers that rely on consistent formatting.
To Reproduce
Deployed to Kubernetes using helm chart (version 0.17.0), config:
processClusterExternalSecret: false
processClusterPushSecret: false
processClusterStore: false
processPushSecret: falseESO operates normally with this config.
Trigger a pod shutdown, observe the following shutdown log output, where one line is not properly formatted as JSON:
{"level":"info","ts":1747826522.6943183,"msg":"Stopping and waiting for non leader election runnables"}
{"level":"info","ts":1747826522.6943562,"msg":"Stopping and waiting for leader election runnables"}
{"level":"info","ts":1747826522.6943893,"msg":"Shutdown signal received, waiting for all workers to finish","controller":"externalsecret","controllerGroup":"external-secrets.io","controllerKind":"ExternalSecret"}
{"level":"info","ts":1747826522.694402,"msg":"Shutdown signal received, waiting for all workers to finish","controller":"secretstore","controllerGroup":"external-secrets.io","controllerKind":"SecretStore"}
{"level":"info","ts":1747826522.6944075,"msg":"Shutdown signal received, waiting for all workers to finish","controller":"generatorstate","controllerGroup":"generators.external-secrets.io","controllerKind":"GeneratorState"}
{"level":"info","ts":1747826522.6944993,"msg":"All workers finished","controller":"generatorstate","controllerGroup":"generators.external-secrets.io","controllerKind":"GeneratorState"}
{"level":"info","ts":1747826522.694529,"msg":"All workers finished","controller":"externalsecret","controllerGroup":"external-secrets.io","controllerKind":"ExternalSecret"}
{"level":"info","ts":1747826522.6945426,"msg":"All workers finished","controller":"secretstore","controllerGroup":"external-secrets.io","controllerKind":"SecretStore"}
{"level":"info","ts":1747826522.6945744,"msg":"Stopping and waiting for caches"}
I0521 11:22:02.694741 1 reflector.go:556] "Warning: watch ended with error" reflector="pkg/mod/k8s.io/client-go@v0.33.0/tools/cache/reflector.go:285" type="*v1.ExternalSecret" err="an error on the server (\"unable to decode an event from the watch stream: context canceled\") has prevented the request from succeeding"
{"level":"info","ts":1747826522.6948051,"msg":"Stopping and waiting for webhooks"}
{"level":"info","ts":1747826522.6948233,"msg":"Stopping and waiting for HTTP servers"}
{"level":"info","ts":1747826522.6948724,"logger":"controller-runtime.metrics","msg":"Shutting down metrics server with timeout of 1 minute"}
{"level":"info","ts":1747826522.6949728,"msg":"Wait completed, proceeding to shutdown the manager"}
Expected behavior
All log lines, including shutdown logs, should be in JSON format for consistency.
Screenshots
Additional context
See the log line below, which is not JSON:
I0521 11:22:02.694741 1 reflector.go:556] "Warning: watch ended with error" reflector="pkg/mod/k8s.io/client-go@v0.33.0/tools/cache/reflector.go:285" type="*v1.ExternalSecret" err="an error on the server (\"unable to decode an event from the watch stream: context canceled\") has prevented the request from succeeding"
This makes it difficult to parse logs programmatically. Please clarify if this is something that can be standardized either in this repo, or if there's a config option that should apply to this.