Browse code

Create sourcable bash env as part of dind cluster deploy

Deploying a dind cluster on a vm provisioned by vagrant will be
assured of having KUBECONFIG and PATH set correctly in the vm. For
manual dind deployment (e.g. to an arbitrary docker instance), this
change adds an rc file that can be sourced to configure the
environment for accessing the cluster with the openshift cli.

Maru Newby authored on 2015/11/21 10:35:02
Showing 2 changed files
... ...
@@ -9,6 +9,7 @@
9 9
 /assets/nbproject
10 10
 /examples/sample-app/openshift.local.*
11 11
 /examples/sample-app/logs/openshift.log
12
+/dind-*.rc
12 13
 *.swp
13 14
 .vimrc
14 15
 .vagrant-openshift.json*
... ...
@@ -232,6 +232,21 @@ ${DEPLOYED_CONFIG_ROOT}"
232 232
       ${DOCKER_CMD} exec -t "${cid}" systemctl start sshd
233 233
     fi
234 234
   done
235
+
236
+  local rc_file="dind-${INSTANCE_PREFIX}.rc"
237
+  local admin_config=$(os::provision::get-admin-config ${CONFIG_ROOT})
238
+  echo "export KUBECONFIG=${admin_config}
239
+export PATH=\$PATH:${ORIGIN_ROOT}/_output/local/bin/linux/amd64" > "${rc_file}"
240
+
241
+  if [ "${KUBECONFIG:-}" != "${admin_config}" ]; then
242
+    echo ""
243
+    echo "Before invoking the openshift cli, make sure to source the
244
+cluster's rc file to configure the bash environment:
245
+
246
+  $ . ${rc_file}
247
+  $ oc get nodes
248
+"
249
+  fi
235 250
 }
236 251
 
237 252
 function stop() {