Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Helm v4 SDK no longer offers the ability to specify a logger per action #31399

@benoittgt

Description

@benoittgt

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 1

Kubernetes version

$ kubectl version
# paste output here

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions