aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank A. Zdarsky <fzdarsky@redhat.com>2018-03-19 19:08:16 +0100
committerFrank A. Zdarsky <fzdarsky@redhat.com>2018-03-19 19:11:14 +0100
commit9ddcc8470c7ed6a2cbddfb079b6396bb58436827 (patch)
tree5e9168dfccda4913096b5a164e5981644bdc52c1
parent1b240633a23aa215872762b1ab0561c70d7f5d43 (diff)
make kube2msb use pod secretv1.1.02.0.0-ONAP2.0.0-ONAP
Issue-ID: OOM-811 Change-Id: I039b6bcc9a301751ba976b77c0f2cc3b904b8e9c Signed-off-by: Frank A. Zdarsky <fzdarsky@redhat.com>
-rw-r--r--build/docker/Dockerfile2
-rw-r--r--src/kube2msb/kube2msb.go6
2 files changed, 6 insertions, 2 deletions
diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile
index 849b07e..f25e592 100644
--- a/build/docker/Dockerfile
+++ b/build/docker/Dockerfile
@@ -1,4 +1,4 @@
FROM alpine:3.3
COPY kube2msb /bin/
-ENTRYPOINT /bin/kube2msb --kube_master_url=${KUBE_MASTER_URL} --msb_url=${MSB_URL} \ No newline at end of file
+ENTRYPOINT /bin/kube2msb --kube_master_url=${KUBE_MASTER_URL} --auth_token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) --msb_url=${MSB_URL}
diff --git a/src/kube2msb/kube2msb.go b/src/kube2msb/kube2msb.go
index 2d39b77..4dac06d 100644
--- a/src/kube2msb/kube2msb.go
+++ b/src/kube2msb/kube2msb.go
@@ -36,6 +36,7 @@ import (
var (
argMSBUrl = flag.String("msb_url", "", "URL to MSB backend")
argKubeMasterUrl = flag.String("kube_master_url", "", "Url to reach kubernetes master. Env variables in this flag will be expanded.")
+ argAuthToken = flag.String("auth_token", "", "Auth token for accessing Kube master.")
addMap = make(map[string]*kapi.Pod)
deleteMap = make(map[string]*kapi.Pod)
nodeSelector = klabels.Everything()
@@ -92,7 +93,10 @@ func newKubeClient() (*kclient.Client, error) {
overrides := &kclientcmd.ConfigOverrides{}
overrides.ClusterInfo.Server = masterUrl
- if token, present := os.LookupEnv("AUTH_TOKEN"); present {
+ if *argAuthToken != "" {
+ overrides.AuthInfo.Token = *argAuthToken
+ overrides.ClusterInfo.InsecureSkipTLSVerify = true
+ } else if token, present := os.LookupEnv("AUTH_TOKEN"); present {
overrides.AuthInfo.Token = token
overrides.ClusterInfo.InsecureSkipTLSVerify = true
}