1
- // Package client initialize a Kubernete's client-go rest.Config or clientset
1
+ // Package client initialize a Kubernete's client-go rest.Config or clientset
2
2
package client
3
3
4
4
import (
@@ -14,9 +14,9 @@ import (
14
14
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
15
15
)
16
16
17
- // NewRestConfig create a *rest.Config, using the kubectl paths and priorities :
18
- // - Command line flags ( api-server and/or kubeconfig path) have higher priorities
19
- // - Else, use the config file path in KUBECONFIG environment variable, if any
17
+ // NewRestConfig create a *rest.Config, trying to mimic kubectl behavior :
18
+ // - Explicit user provided api-server ( and/or kubeconfig path) have higher priorities
19
+ // - Else, use the config file path in KUBECONFIG environment variable ( if any)
20
20
// - Else, use the config file in ~/.kube/config, if any
21
21
// - Else, consider we're running in cluster (in a pod), and use the pod's service
22
22
// account and cluster's kubernetes.default service.
@@ -45,8 +45,6 @@ func NewRestConfig(apiserver string, kubeconfig string) (*rest.Config, error) {
45
45
}
46
46
47
47
// NewClientSet create a clientset (a client connection to a Kubernetes cluster).
48
- // It will connect using the optional apiserver or kubeconfig options, or will
49
- // default to the automatic, in cluster settings.
50
48
func NewClientSet (apiserver string , kubeconfig string ) (* kubernetes.Clientset , error ) {
51
49
config , err := NewRestConfig (apiserver , kubeconfig )
52
50
if err != nil {
0 commit comments