Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/compute-domain-daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,17 @@ func newApp() *cli.App {
// later runtime inspection (it's otherwise not accessible anymore
// because we do not expose the raw `cliFlags`.
flags.klogVerbosity = int(loggingConfig.Config.Verbosity)
pkgflags.LogStartupConfig(flags, loggingConfig)
return err
},
Commands: []*cli.Command{
{
Name: "run",
Usage: "Run the compute domain daemon",
Before: func(c *cli.Context) error {
// `check` (e.g. startupProbe) does not use this hook — avoid noisy logs on every probe.
pkgflags.LogStartupConfig(flags, loggingConfig)
return nil
},
Action: func(c *cli.Context) error {
return wrapper(c.Context, run)
},
Expand Down
9 changes: 9 additions & 0 deletions internal/info/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ func GetVersionParts() []string {
return v
}

// GetGitCommit returns the git commit the binary was built from, or "unknown"
// when not set at link time.
func GetGitCommit() string {
if gitCommit != "" {
return gitCommit
}
return "unknown"
}

// GetVersionString returns the string representation of the version.
func GetVersionString(more ...string) string {
v := append(GetVersionParts(), more...)
Expand Down
4 changes: 3 additions & 1 deletion pkg/flags/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"k8s.io/klog/v2"
"k8s.io/utils/dump"

"sigs.k8s.io/dra-driver-nvidia-gpu/internal/info"
"sigs.k8s.io/dra-driver-nvidia-gpu/pkg/featuregates"
)

Expand All @@ -40,7 +41,8 @@ func pflagToCLI(flag *pflag.Flag, category string) cli.Flag {

func LogStartupConfig(parsedFlags any, loggingConfig *LoggingConfig) {
// Always log component startup config (level 0).
klog.Infof("\nFeature gates: %#v\nFlags: %s",
klog.Infof("Commit: %s\n\nFeature gates: %#v\nFlags: %s",
info.GetGitCommit(),
// Flat boolean map -- no pretty-printing needed.
featuregates.ToMap(),
// Based on go-spew's Sdump(), with indentation. Type information is
Expand Down
Loading