Skip to content

Commit

Permalink
Merge pull request #228 from openshift-kni/log-version-startup-4.15
Browse files Browse the repository at this point in the history
[KNI][release-4.15][manual] cmd: dump version on startup
  • Loading branch information
openshift-merge-bot[bot] authored Sep 3, 2024
2 parents bada5d9 + 1ecbcdf commit 128553b
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 128553b

Please sign in to comment.