From 50b9eefd2b6266b29755e37090138096a2aebc31 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Wed, 17 Feb 2016 13:05:12 -0500 Subject: First past at the upgrade process --- roles/openshift_cli/tasks/main.yml | 7 +------ roles/openshift_cli/templates/openshift.j2 | 11 ++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'roles/openshift_cli') diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index a6b6b1925..e9d7f4afe 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -9,11 +9,6 @@ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool -- name: Pull CLI Image - command: > - docker pull {{ openshift.common.cli_image }} - when: openshift.common.is_containerized | bool - - name: Create /usr/local/bin/openshift cli wrapper template: src: openshift.j2 @@ -30,4 +25,4 @@ - /usr/local/bin/oadm - /usr/local/bin/oc - /usr/local/bin/kubectl - when: openshift.common.is_containerized | bool \ No newline at end of file + when: openshift.common.is_containerized | bool diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index a7c148a22..d2a3f066c 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -20,4 +20,13 @@ See https://docs.openshift.org/latest/cli_reference/get_started_cli.html ================================================================================= """ -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="" +if ! docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} {{ openshift.common.service_type }}-master | grep running > /dev/null; then +>&2 echo """ + +Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image. +""" + image=:`docker inspect -f {% raw %}'{{ .Image }}'{% endraw %} {{ openshift.common.service_type }}-master` +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} "${@}" -- cgit v1.2.3 From 9423af3e5feb8cd9bb5e1c43a22c01ac6b57a89f Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Thu, 25 Feb 2016 10:52:26 -0500 Subject: Updating the containerized cli wrapper to work for both docker 1.8 and 1.9 --- roles/openshift_cli/templates/openshift.j2 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'roles/openshift_cli') diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index d2a3f066c..e9155e76d 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -20,13 +20,26 @@ See https://docs.openshift.org/latest/cli_reference/get_started_cli.html ================================================================================= """ -image="" -if ! docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} {{ openshift.common.service_type }}-master | grep running > /dev/null; then ->&2 echo """ +container="{{ openshift.common.service_type }}-master" +is_running=false -Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image. -""" +docker19_status=`docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} $container` +if [ "$docker19_status" == "" ]; 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} "${@}" -- cgit v1.2.3 From 7d561bd252a4ddc9e204f31144fbed7fecd99bff Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Sun, 28 Feb 2016 16:32:38 -0500 Subject: Correctly set the image tag for containerized installs (and upgrades) --- roles/openshift_cli/templates/openshift.j2 | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'roles/openshift_cli') diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index e9155e76d..f969a4bab 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -5,10 +5,11 @@ fi cmd=`basename $0` user=`id -u` group=`id -g` +image_tag={{ image_tag | default(openshift.common.image_tag) }} >&2 echo """ ================================================================================ -ATTENTION: You are running ${cmd} via a wrapper around 'docker run {{ openshift.common.cli_image }}'. +ATTENTION: You are running ${cmd} via a wrapper around 'docker run {{ openshift.common.cli_image }}:${image_tag}'. 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. @@ -20,26 +21,4 @@ See https://docs.openshift.org/latest/cli_reference/get_started_cli.html ================================================================================= """ -container="{{ openshift.common.service_type }}-master" -is_running=false - -docker19_status=`docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} $container` -if [ "$docker19_status" == "" ]; 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} "${@}" +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_tag} "${@}" -- cgit v1.2.3