예제 #1
0
func main() {
	flag.Parse()

	bearerToken, err := ioutil.ReadFile(*argBearerTokenFile)
	if err != nil {
		log.Fatal(err)
	}

	config := client.Config{
		Host:        *argMaster,
		Insecure:    *argInsecure,
		BearerToken: string(bearerToken),
		Version:     *argApiVersion,
	}

	if _, err := os.Stat(*argCaCertFile); err == nil {
		config.Insecure = false
		config.TLSClientConfig = client.TLSClientConfig{
			CAFile: *argCaCertFile,
		}
	}

	client := client.NewOrDie(&config)
	done := make(chan bool)
	go watchNodes(client)
	<-done
}