top

Package clientcmd provides one stop shopping for building a working client from a fixed config, from a .kubeconfig file, from command line flags, or from any merged combination.

Sample usage from merged .kubeconfig files (local directory, home directory)

loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
// if you want to change the loading rules (which files in which order), you can do so here

configOverrides := &clientcmd.ConfigOverrides{}
// if you want to change override values or bind them to flags, there are methods to help you

kubeConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)
config, err := kubeConfig.ClientConfig()
if err != nil {
	// Do something
}
client, err := unversioned.New(config)
// ...

Imports 13 package(s)

  1. k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api/latest
  2. k8s.io/kubernetes/pkg/client/restclient
  3. github.com/golang/glog
  4. k8s.io/kubernetes/pkg/client/unversioned/auth
  5. k8s.io/kubernetes/pkg/util/homedir
  6. k8s.io/kubernetes/pkg/util/errors
  7. k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api
  8. k8s.io/kubernetes/pkg/runtime
  9. github.com/imdario/mergo
  10. k8s.io/kubernetes/pkg/api
  11. k8s.io/kubernetes/pkg/util/validation
  12. k8s.io/kubernetes/pkg/api/unversioned
  13. github.com/spf13/pflag

Test imports 1 package(s)

  1. github.com/ghodss/yaml