-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
What happened?
While testing Helm v4 SDK. One regression for us is the inability to pass a custom logger to action.Init anymore. (before).
I understand the change, but it removes the SDK’s ability to easily attach specific log contexts per action.
At work, we enrich logs with request metadata before sending them via webhook or message queue, so each Helm action has properly scoped logs with a deployment id we provide. It works very well.
I had started implementing something similar when migrating parts of Helm to slog, but it was later removed. Still the regression is my fault.
Currently, the only way I see is through slog.SetDefault(customLogger), which is global and can’t handle concurrent requests properly.
It will be a regression for Flux too. See https://github.com/fluxcd/helm-controller/blob/de97aa9d843c2e9765de217470ba67195b5ce733/internal/action/config.go#L52
What did you expect to happen?
Be able to have a custom logger per action.
How can we reproduce it (as minimally and precisely as possible)?
It is via SDK but code will look like
if err := actionConfig.Init(
settings.RESTClientGetter(),
namespace,
helmDriver,
- logger.Printf); err != nil {
+ ); err != nil {
return nil, err
}Helm version
$ helm version
v4 beta 1Kubernetes version
$ kubectl version
# paste output here