forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clientconfig.go
24 lines (18 loc) · 907 Bytes
/
clientconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package clientcmd
import (
"github.com/spf13/pflag"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
"github.com/openshift/origin/pkg/cmd/cli/config"
)
func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig {
loadingRules := config.NewOpenShiftClientConfigLoadingRules()
flags.StringVar(&loadingRules.ExplicitPath, config.OpenShiftConfigFlagName, "", "Path to the config file to use for CLI requests.")
overrides := &clientcmd.ConfigOverrides{}
overrideFlags := clientcmd.RecommendedConfigOverrideFlags("")
overrideFlags.ContextOverrideFlags.Namespace.ShortName = "n"
overrideFlags.AuthOverrideFlags.Username.LongName = ""
overrideFlags.AuthOverrideFlags.Password.LongName = ""
clientcmd.BindOverrideFlags(overrides, flags, overrideFlags)
clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, overrides)
return clientConfig
}