aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuabingZhao <zhao.huabing@zte.com.cn>2017-10-26 11:55:09 +0800
committerHuabingZhao <zhao.huabing@zte.com.cn>2017-10-26 11:55:15 +0800
commit9b3c0b01331e4b9b90f9bc491f56bc2c444cde32 (patch)
tree22b84a5a32ccaf50d909db12264fab92c8d65b6f
parente3e197dba342c76cb05aa16652682094020d8abf (diff)
Supports token authentication with kubernets
Issue-Id: OOM-379 Change-Id: If5457672f29f2567a6773d96985b62ad8cef5d0c Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
-rw-r--r--src/kube2msb/kube2msb.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/kube2msb/kube2msb.go b/src/kube2msb/kube2msb.go
index 627405e..2d39b77 100644
--- a/src/kube2msb/kube2msb.go
+++ b/src/kube2msb/kube2msb.go
@@ -92,6 +92,11 @@ func newKubeClient() (*kclient.Client, error) {
overrides := &kclientcmd.ConfigOverrides{}
overrides.ClusterInfo.Server = masterUrl
+ if token, present := os.LookupEnv("AUTH_TOKEN"); present {
+ overrides.AuthInfo.Token = token
+ overrides.ClusterInfo.InsecureSkipTLSVerify = true
+ }
+
rules := kclientcmd.NewDefaultClientConfigLoadingRules()
kubeConfig, err := kclientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides).ClientConfig()