adjust client-go User-Agent

This commit is contained in:
Andy Xie
2018-06-24 10:39:28 +08:00
parent 2f915ecf29
commit 866ae661da
2 changed files with 8 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ import (
"encoding/json"
"fmt"
"net/url"
"os"
"path/filepath"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
@@ -30,6 +32,7 @@ import (
"k8s.io/heapster/common/kubernetes"
"k8s.io/node-problem-detector/cmd/options"
"k8s.io/node-problem-detector/pkg/version"
)
// Client is the interface of problem client
@@ -62,6 +65,7 @@ func NewClientOrDie(npdo *options.NodeProblemDetectorOptions) Client {
panic(err)
}
cfg.UserAgent = fmt.Sprintf("%s/%s", filepath.Base(os.Args[0]), version.Version())
// TODO(random-liu): Set QPS Limit
c.client = client.NewOrDie(cfg)
c.nodeName = npdo.NodeName

View File

@@ -18,6 +18,10 @@ import "fmt"
// version defines node-problem-detector version string.
var version string = "UNKNOWN"
func Version() string {
return version
}
func PrintVersion() {
fmt.Println(version)
}