authConfig=flag.String("auth",os.Getenv("HOME")+"/.kubernetes_auth","Path to the auth info file. If missing, prompt the user. Only used if doing https.")
portSpec=flag.String("p","","The port spec, comma-separated list of <external>:<internal>,...")
json=flag.Bool("json",false,"If true, print raw JSON for responses")
servicePort=flag.Int("s",-1,"If positive, create and run a corresponding service on this port, only used with 'run'")
yaml=flag.Bool("yaml",false,"If true, print raw YAML for responses")
authConfig=flag.String("auth",os.Getenv("HOME")+"/.kubernetes_auth","Path to the auth info file. If missing, prompt the user. Only used if doing https.")
verbose=flag.Bool("verbose",false,"If true, print extra information")
json=flag.Bool("json",false,"If true, print raw JSON for responses")
proxy=flag.Bool("proxy",false,"If true, run a proxy to the api server")
yaml=flag.Bool("yaml",false,"If true, print raw YAML for responses")
www=flag.String("www","","If -proxy is true, use this directory to serve static files")
verbose=flag.Bool("verbose",false,"If true, print extra information")
templateFile=flag.String("template_file","","If present, load this file as a golang template and use it for output printing")
proxy=flag.Bool("proxy",false,"If true, run a proxy to the api server")
templateStr=flag.String("template","","If present, parse this string as a golang template and use it for output printing")
www=flag.String("www","","If -proxy is true, use this directory to serve static files")
templateFile=flag.String("template_file","","If present, load this file as a golang template and use it for output printing")
templateStr=flag.String("template","","If present, parse this string as a golang template and use it for output printing")
)
)
funcusage(){
funcusage(){
...
@@ -107,7 +108,7 @@ func main() {
...
@@ -107,7 +108,7 @@ func main() {
deferutil.FlushLogs()
deferutil.FlushLogs()
if*versionFlag{
if*versionFlag{
fmt.Println("Version:",AppVersion)
fmt.Printf("Version: %#v\n",version.Get())
os.Exit(0)
os.Exit(0)
}
}
...
@@ -136,6 +137,30 @@ func main() {
...
@@ -136,6 +137,30 @@ func main() {
}
}
}
}
client:=kube_client.New(masterServer,auth)
if*serverVersion{
got,err:=client.ServerVersion()
iferr!=nil{
fmt.Printf("Couldn't read version from server: %v\n",err)
os.Exit(1)
}
fmt.Printf("Server Version: %#v\n",got)
os.Exit(0)
}
if*preventSkew{
got,err:=client.ServerVersion()
iferr!=nil{
fmt.Printf("Couldn't read version from server: %v\n",err)