Skip to content

Commit

Permalink
[KNI] cmd: dump version on startup
Browse files Browse the repository at this point in the history
log the component version first time as startup to
make the troubleshooting (a bit) easier.

Signed-off-by: Francesco Romani <[email protected]>
(cherry picked from commit 37426d9)
  • Loading branch information
ffromani committed Sep 3, 2024
1 parent 1a5f596 commit f48cc41
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/noderesourcetopology-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import (
"os"
"time"

"github.com/go-logr/logr"

utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/component-base/logs"
"k8s.io/component-base/version"
"k8s.io/klog/v2/klogr"
"k8s.io/kubernetes/cmd/kube-scheduler/app"

Expand All @@ -37,12 +40,13 @@ import (
)

func main() {
logh := klogr.NewWithOptions(klogr.WithFormat(klogr.FormatKlog))
printVersion(logh) // this must be the first thing logged ever. Note: we can't use V() yet - no flags parsed

utilfeature.DefaultMutableFeatureGate.SetFromMap(knifeatures.Desired())

rand.Seed(time.Now().UnixNano())

logh := klogr.NewWithOptions(klogr.WithFormat(klogr.FormatKlog))

knistatus.Setup(logh)

// Register custom plugins to the scheduler framework.
Expand All @@ -64,3 +68,8 @@ func main() {
os.Exit(1)
}
}

func printVersion(logh logr.Logger) {
ver := version.Get()
logh.Info("starting noderesourcetopology scheduler", "version", ver.GitVersion, "goversion", ver.GoVersion, "platform", ver.Platform)
}

0 comments on commit f48cc41

Please sign in to comment.