mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-11-05 05:01:34 +01:00
Changed dependency to k8s.io-libs entirely to kubernetes-1.13.11.
This commit is contained in:
parent
5a1715b582
commit
dda6a331b3
@ -32,6 +32,7 @@ import (
|
|||||||
istiocontroller "istio.io/istio/pilot/pkg/config/kube/crd/controller"
|
istiocontroller "istio.io/istio/pilot/pkg/config/kube/crd/controller"
|
||||||
istiomodel "istio.io/istio/pilot/pkg/model"
|
istiomodel "istio.io/istio/pilot/pkg/model"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -219,13 +220,26 @@ func BuildWithConfig(source string, p ClientGenerator, cfg *Config) (Source, err
|
|||||||
// uses KubeMaster and KubeConfig attributes to connect to the cluster. If
|
// uses KubeMaster and KubeConfig attributes to connect to the cluster. If
|
||||||
// KubeConfig isn't provided it defaults to using the recommended default.
|
// KubeConfig isn't provided it defaults to using the recommended default.
|
||||||
func NewKubeClient(kubeConfig, kubeMaster string, requestTimeout time.Duration) (*kubernetes.Clientset, error) {
|
func NewKubeClient(kubeConfig, kubeMaster string, requestTimeout time.Duration) (*kubernetes.Clientset, error) {
|
||||||
|
log.Infof("Instantiating new Kubernetes client")
|
||||||
|
|
||||||
if kubeConfig == "" {
|
if kubeConfig == "" {
|
||||||
if _, err := os.Stat(clientcmd.RecommendedHomeFile); err == nil {
|
if _, err := os.Stat(clientcmd.RecommendedHomeFile); err == nil {
|
||||||
kubeConfig = clientcmd.RecommendedHomeFile
|
kubeConfig = clientcmd.RecommendedHomeFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Debugf("kubeMaster: %s", kubeMaster)
|
||||||
|
log.Debugf("kubeConfig: %s", kubeConfig)
|
||||||
|
|
||||||
config, err := clientcmd.BuildConfigFromFlags(kubeMaster, kubeConfig)
|
// evaluate whether to use kubeConfig-file or serviceaccount-token
|
||||||
|
var config *rest.Config
|
||||||
|
var err error
|
||||||
|
if kubeConfig == "" {
|
||||||
|
log.Infof("Using inCluster-config based on serviceaccount-token")
|
||||||
|
config, err = rest.InClusterConfig()
|
||||||
|
} else {
|
||||||
|
log.Infof("Using kubeConfig")
|
||||||
|
config, err = clientcmd.BuildConfigFromFlags(kubeMaster, kubeConfig)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user