blob: e9155e76d66c069b84f66c057eb7dda24d8ae70b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/bash
if [ ! -d ~/.kube ]; then
mkdir -m 0700 ~/.kube
fi
cmd=`basename $0`
user=`id -u`
group=`id -g`
>&2 echo """
================================================================================
ATTENTION: You are running ${cmd} via a wrapper around 'docker run {{ openshift.common.cli_image }}'.
This wrapper is intended only to be used to bootstrap an environment. Please
install client tools on another host once you have granted cluster-admin
privileges to a user.
{% if openshift.common.deployment_type in ['openshift-enterprise','atomic-enterprise'] %}
See https://docs.openshift.com/enterprise/latest/cli_reference/get_started_cli.html
{% else %}
See https://docs.openshift.org/latest/cli_reference/get_started_cli.html
{% endif %}
=================================================================================
"""
container="{{ openshift.common.service_type }}-master"
is_running=false
docker19_status=`docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} $container`
if [ "$docker19_status" == "<no value>" ]; then
if docker inspect -f {% raw %}'{{ .State.Running }}'{% endraw %} $container | grep -i true > /dev/null; then
is_running=true
fi
elif [ "$docker19_status" == "running" ]; then
is_running=true
fi
if $is_running; then
image=:`docker inspect -f {% raw %}'{{ .Image }}'{% endraw %} {{ openshift.common.service_type }}-master`
else
>&2 echo """
Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image.
"""
image=:latest
fi
docker run -i --privileged --net=host --user=${user}:${group} -v ~/.kube:/root/.kube -v /tmp:/tmp -v {{ openshift.common.config_base}}:{{ openshift.common.config_base }} -e KUBECONFIG=/root/.kube/config --entrypoint ${cmd} --rm {{ openshift.common.cli_image }}${image} "${@}"
|