Support for kubeconfig files (#2053)

* Add support for authentication with kubeconfig files

* Update k8s plugin documentation

* Fix whitespace in README and tests

* Use clientcmd package to load kubeconfig file
This commit is contained in:
Zach Eddy 2018-09-28 12:18:55 -07:00 committed by John Belamaric
parent 2fc3f5e0b1
commit fe5c731047
4 changed files with 59 additions and 0 deletions

View file

@ -37,6 +37,7 @@ type Kubernetes struct {
APICertAuth string
APIClientCert string
APIClientKey string
ClientConfig clientcmd.ClientConfig
APIConn dnsController
Namespaces map[string]bool
podMode string
@ -153,6 +154,9 @@ func (k *Kubernetes) IsNameError(err error) bool {
}
func (k *Kubernetes) getClientConfig() (*rest.Config, error) {
if k.ClientConfig != nil {
return k.ClientConfig.ClientConfig()
}
loadingRules := &clientcmd.ClientConfigLoadingRules{}
overrides := &clientcmd.ConfigOverrides{}
clusterinfo := clientcmdapi.Cluster{}