adjust client-go User-Agent
This commit is contained in:
parent
bdcb2eb490
commit
e025e06707
1
main.go
1
main.go
|
|
@ -116,6 +116,7 @@ func createKubeClient(apiserver string, kubeconfig string) (clientset.Interface,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
config.UserAgent = version.GetVersion().String()
|
||||
config.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json"
|
||||
config.ContentType = "application/vnd.kubernetes.protobuf"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ package version
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
|
|
@ -36,6 +38,12 @@ type Version struct {
|
|||
Platform string
|
||||
}
|
||||
|
||||
func (v Version) String() string {
|
||||
return fmt.Sprintf("%s/%s (%s/%s) kube-state-metrics/%s",
|
||||
filepath.Base(os.Args[0]), v.Release,
|
||||
runtime.GOOS, runtime.GOARCH, v.GitCommit)
|
||||
}
|
||||
|
||||
// GetVersion returns kube-state-metrics version
|
||||
func GetVersion() Version {
|
||||
return Version{
|
||||
|
|
|
|||
Loading…
Reference in New Issue