mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #1297 from marquiz/devel/topology-updater-version
topology-updater: make -version always runnable
This commit is contained in:
commit
a658c54de3
1 changed files with 6 additions and 7 deletions
|
@ -43,15 +43,8 @@ var DefaultKubeletStateDir = path.Join(string(hostpath.VarDir), "lib", "kubelet"
|
||||||
func main() {
|
func main() {
|
||||||
flags := flag.NewFlagSet(ProgramName, flag.ExitOnError)
|
flags := flag.NewFlagSet(ProgramName, flag.ExitOnError)
|
||||||
|
|
||||||
printVersion := flags.Bool("version", false, "Print version and exit.")
|
|
||||||
|
|
||||||
args, resourcemonitorArgs := parseArgs(flags, os.Args[1:]...)
|
args, resourcemonitorArgs := parseArgs(flags, os.Args[1:]...)
|
||||||
|
|
||||||
if *printVersion {
|
|
||||||
fmt.Println(ProgramName, version.Get())
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assert that the version is known
|
// Assert that the version is known
|
||||||
if version.Undefined() {
|
if version.Undefined() {
|
||||||
klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.")
|
klog.InfoS("version not set! Set -ldflags \"-X sigs.k8s.io/node-feature-discovery/pkg/version.version=`git describe --tags --dirty --always`\" during build or run.")
|
||||||
|
@ -75,6 +68,7 @@ func main() {
|
||||||
|
|
||||||
func parseArgs(flags *flag.FlagSet, osArgs ...string) (*topology.Args, *resourcemonitor.Args) {
|
func parseArgs(flags *flag.FlagSet, osArgs ...string) (*topology.Args, *resourcemonitor.Args) {
|
||||||
args, resourcemonitorArgs := initFlags(flags)
|
args, resourcemonitorArgs := initFlags(flags)
|
||||||
|
printVersion := flags.Bool("version", false, "Print version and exit.")
|
||||||
|
|
||||||
_ = flags.Parse(osArgs)
|
_ = flags.Parse(osArgs)
|
||||||
if len(flags.Args()) > 0 {
|
if len(flags.Args()) > 0 {
|
||||||
|
@ -83,6 +77,11 @@ func parseArgs(flags *flag.FlagSet, osArgs ...string) (*topology.Args, *resource
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *printVersion {
|
||||||
|
fmt.Println(ProgramName, version.Get())
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if len(resourcemonitorArgs.KubeletConfigURI) == 0 {
|
if len(resourcemonitorArgs.KubeletConfigURI) == 0 {
|
||||||
nodeAddress := os.Getenv("NODE_ADDRESS")
|
nodeAddress := os.Getenv("NODE_ADDRESS")
|
||||||
if len(nodeAddress) == 0 {
|
if len(nodeAddress) == 0 {
|
||||||
|
|
Loading…
Reference in a new issue