Skip to content

Commit

Permalink
Merge pull request #123 from fuweid/add-debug-log-for-helm
Browse files Browse the repository at this point in the history
helmcli: introduce debug log
  • Loading branch information
fuweid authored May 13, 2024
2 parents b57e2b8 + 06c34a6 commit 45c17ba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion helmcli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewDeleteCli(kubeconfigPath string, namespace string) (*DeleteCli, error) {
},
namespace,
"secret",
noopLog,
debugLog,
); err != nil {
return nil, fmt.Errorf("failed to init action config: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion helmcli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewGetCli(kubeconfigPath string, namespace string) (*GetCli, error) {
},
namespace,
"secret",
noopLog,
debugLog,
); err != nil {
return nil, fmt.Errorf("failed to init action config: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion helmcli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewListCli(kubeconfigPath string, namespace string) (*ListCli, error) {
},
namespace,
"secret",
noopLog,
debugLog,
); err != nil {
return nil, fmt.Errorf("failed to init action config: %w", err)
}
Expand Down
10 changes: 6 additions & 4 deletions helmcli/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import (
"helm.sh/helm/v3/pkg/storage/driver"
"helm.sh/helm/v3/pkg/strvals"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/klog/v2"
)

var noopLog action.DebugLog = func(_ string, _ ...interface{}) {}
var debugLog action.DebugLog = func(fmt string, args ...interface{}) {
klog.V(2).Infof(fmt, args...)
}

// ValuesApplier is to apply new key/values to existing chart's values.
type ValuesApplier func(values map[string]interface{}) error
Expand Down Expand Up @@ -96,8 +99,7 @@ type ReleaseCli struct {
// NewReleaseCli returns new ReleaseCli instance.
//
// TODO:
// 1. show debug log.
// 2. add flag to disable Wait
// 1. add flag to disable Wait
func NewReleaseCli(
kubeconfigPath string,
namespace string,
Expand Down Expand Up @@ -125,7 +127,7 @@ func NewReleaseCli(
},
namespace,
"secret",
noopLog,
debugLog,
); err != nil {
return nil, fmt.Errorf("failed to init action config: %w", err)
}
Expand Down

0 comments on commit 45c17ba

Please sign in to comment.