Skip to content

Commit 53d98fc

Browse files
committed
add logger func
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
1 parent e76a82a commit 53d98fc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pkg/helm/helm3lib/helm3lib.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import (
1212
"time"
1313

1414
"github.com/deckhouse/deckhouse/pkg/log"
15+
logContext "github.com/deckhouse/deckhouse/pkg/log/context"
16+
"github.com/flant/addon-operator/pkg/helm/client"
17+
"github.com/flant/addon-operator/pkg/helm/post_renderer"
18+
"github.com/flant/addon-operator/pkg/utils"
1519
"helm.sh/helm/v3/pkg/action"
1620
"helm.sh/helm/v3/pkg/chart/loader"
1721
"helm.sh/helm/v3/pkg/chartutil"
@@ -24,10 +28,6 @@ import (
2428
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2529
"k8s.io/cli-runtime/pkg/genericclioptions"
2630
"k8s.io/client-go/rest"
27-
28-
"github.com/flant/addon-operator/pkg/helm/client"
29-
"github.com/flant/addon-operator/pkg/helm/post_renderer"
30-
"github.com/flant/addon-operator/pkg/utils"
3131
)
3232

3333
var helmPostRenderer *post_renderer.PostRenderer
@@ -127,7 +127,13 @@ func (h *LibClient) actionConfigInit() error {
127127

128128
// If env is empty - default storage backend ('secrets') will be used
129129
helmDriver := os.Getenv("HELM_DRIVER")
130-
err := ac.Init(getter, options.Namespace, helmDriver, h.Logger.Debug)
130+
131+
formattedLogFunc := func(format string, v ...interface{}) {
132+
ctx := logContext.SetCustomKeyContext(context.Background())
133+
h.Logger.Log(ctx, slog.LevelDebug, fmt.Sprintf(format, v))
134+
}
135+
136+
err := ac.Init(getter, options.Namespace, helmDriver, formattedLogFunc)
131137
if err != nil {
132138
return fmt.Errorf("init helm action config: %v", err)
133139
}

0 commit comments

Comments
 (0)