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 := metav1.New(config)
// ...

Imports 14 package(s)

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

Test imports 1 package(s)

  1. github.com/ghodss/yaml