From 477f04a7a9846579d2bc86d9c260d9849f593961 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Wed, 6 Apr 2016 10:42:12 -0400 Subject: Containerized installs on RHEL were downgrading docker unnecessarily --- .../upgrades/v3_1_to_v3_2/pre.yml | 10 ++++----- .../upgrades/v3_1_to_v3_2/upgrade.yml | 26 ++++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'playbooks') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index 6e6f31195..47f22c4e8 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -57,6 +57,11 @@ roles: - openshift_facts tasks: + - openshift_facts: + role: master + local_facts: + ha: "{{ groups.oo_masters_to_config | length > 1 }}" + - name: Ensure Master is running service: name: "{{ openshift.common.service_type }}-master" @@ -77,11 +82,6 @@ state: started enabled: yes when: openshift.master.ha is defined and openshift.master.ha | bool and openshift.common.is_containerized | bool - post_tasks: - - openshift_facts: - role: master - local_facts: - ha: "{{ groups.oo_masters_to_config | length > 1 }}" - name: Verify upgrade can proceed hosts: oo_nodes_to_config diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 041ad5a9a..212cdab66 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -1,5 +1,19 @@ --- +############################################################################### +# The restart playbook should be run after this playbook completes. +############################################################################### + +- name: Upgrade docker + hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config + roles: + - openshift_facts + tasks: + - include: docker_upgrade.yml + when: not openshift.common.is_atomic | bool + # This is a workaround for authenticated registries +# This has to happen after the docker upgrade due to a bug in docker 1.8.2's +# --add-registry implementation - name: Download new images hosts: oo_nodes_to_config roles: @@ -28,18 +42,6 @@ with_items: - "{{ openshift.master.master_image }}" -############################################################################### -# The restart playbook should be run after this playbook completes. -############################################################################### - -- name: Upgrade docker - hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config - roles: - - openshift_facts - tasks: - - include: docker_upgrade.yml - when: not openshift.common.is_atomic | bool - ############################################################################### # Upgrade Masters ############################################################################### -- cgit v1.2.3 From f443be046bdd69db223f8ba5ec6c13636f66c52f Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Thu, 7 Apr 2016 15:09:09 -0400 Subject: Handle cases where the pacemaker variables aren't set --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'playbooks') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index 47f22c4e8..7e3253d8f 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -38,7 +38,7 @@ msg: > This upgrade does not support Pacemaker: https://docs.openshift.{{ g_pacemaker_upgrade_url_segment }}/install_config/upgrading/pacemaker_to_native_ha.html - when: openshift.master.cluster_method == 'pacemaker' + when: openshift.master.cluster_method is defined and openshift.master.cluster_method == 'pacemaker' - fail: msg: > -- cgit v1.2.3 From 463737fd43a841b829d5c7824daf0d996e264a85 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Fri, 8 Apr 2016 15:25:30 -0400 Subject: Installs and upgrades from authenticated registries are not supported for now --- .../upgrades/v3_1_to_v3_2/upgrade.yml | 31 ---------------------- 1 file changed, 31 deletions(-) (limited to 'playbooks') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 212cdab66..957a22ce9 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -11,37 +11,6 @@ - include: docker_upgrade.yml when: not openshift.common.is_atomic | bool -# This is a workaround for authenticated registries -# This has to happen after the docker upgrade due to a bug in docker 1.8.2's -# --add-registry implementation -- name: Download new images - hosts: oo_nodes_to_config - roles: - - openshift_facts - tasks: - - name: Pull Images - command: > - docker pull {{ item }}:v{{ g_new_version }} - with_items: - - "{{ openshift.node.node_image }}" - - "{{ openshift.node.ovs_image }}" - - "{{ openshift.common.pod_image }}" - - "{{ openshift.common.router_image }}" - - "{{ openshift.common.registry_image }}" - - "{{ openshift.common.deployer_image }}" - -# This is a workaround for authenticated registries -- name: Download new images - hosts: oo_masters_to_config - roles: - - openshift_facts - tasks: - - name: Pull Images - command: > - docker pull {{ item }}:v{{ g_new_version }} - with_items: - - "{{ openshift.master.master_image }}" - ############################################################################### # Upgrade Masters ############################################################################### -- cgit v1.2.3 From ff06c2e87d1a6ccc9d1cd68cf978eae950c63d31 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Mon, 11 Apr 2016 13:45:01 -0400 Subject: Make sure Docker is restarted after we have correctly configured the containerized systemd units --- playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'playbooks') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index 7e3253d8f..c1dabc150 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -105,8 +105,12 @@ - include: ../../../../../roles/openshift_master/handlers/main.yml - include: ../../../../../roles/openshift_node/handlers/main.yml roles: + # We want the cli role to evaluate so that the containerized oc/oadm wrappers + # are modified to use the correct image tag. However, this can trigger a + # docker restart if new configuration is laid down which would immediately + # pull the latest image and defeat the purpose of these tasks. - openshift_cli - tasks: + pre_tasks: - name: Clean package cache command: "{{ ansible_pkg_mgr }} clean all" when: not openshift.common.is_atomic | bool -- cgit v1.2.3 From 09d6e9ffe41ad282e8abd064cc70d70b5ae7fb1c Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Mon, 11 Apr 2016 15:26:33 -0400 Subject: Fetching the current version a little more carefully Previously we were trying to use the running container to get the current version. There are cases in which the Master or Node may not be running during upgrade. It's actually safer to just run the container to fetch the version that would be launch if the container were running. Then we pull the image to see what the latest image contains. --- .../upgrades/files/openshift_container_versions.sh | 10 +++++----- .../common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'playbooks') diff --git a/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh b/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh index 7a1edf38f..96944a78b 100644 --- a/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh +++ b/playbooks/common/openshift-cluster/upgrades/files/openshift_container_versions.sh @@ -3,19 +3,19 @@ # Here we don't really care if this is a master, api, controller or node image. # We just need to know the version of one of them. unit_file=$(ls /etc/systemd/system/${1}*.service | head -n1) -installed_container_name=$(basename -s .service ${unit_file}) -installed=$(docker exec ${installed_container_name} openshift version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v') if [ ${1} == "origin" ]; then image_name="openshift/origin" elif grep aep $unit_file 2>&1 > /dev/null; then - image_name="aep3/aep" + image_name="aep3/node" elif grep openshift3 $unit_file 2>&1 > /dev/null; then - image_name="openshift3/ose" + image_name="openshift3/node" fi +installed=$(docker run --rm --entrypoint=/bin/openshift ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v') + docker pull ${image_name} 2>&1 > /dev/null -available=$(docker run --rm ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v') +available=$(docker run --rm --entrypoint=/bin/openshift ${image_name} version 2> /dev/null | grep openshift | awk '{ print $2 }' | cut -f1 -d"-" | tr -d 'v') echo "---" echo "curr_version: ${installed}" diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index c1dabc150..21480ba55 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -149,6 +149,10 @@ g_new_version: "{{ openshift_image_tag | replace('v','') }}" when: openshift_image_tag is defined + - fail: + msg: Verifying the correct version was found + when: g_aos_versions.curr_version == "" + - fail: msg: Verifying the correct version was found when: verify_upgrade_version is defined and g_new_version != verify_upgrade_version -- cgit v1.2.3 From 0879620498b1251f3a375b9a5657c16dd571906a Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Mon, 11 Apr 2016 16:41:48 -0400 Subject: Bug 1324728 - Ansible should not downgrade docker when installing 3.2 containerized env --- .../openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'playbooks') diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 957a22ce9..eb12fcabe 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -11,6 +11,20 @@ - include: docker_upgrade.yml when: not openshift.common.is_atomic | bool +# The cli image is used by openshift_facts to determine the currently installed +# version. We need to explicitly pull the latest image to handle cases where +# the locally cached 'latest' tag is older the g_new_version. +- name: Download cli image + hosts: oo_masters_to_config:oo_nodes_to_config + roles: + - openshift_facts + tasks: + - name: Pull Images + command: > + docker pull {{ item }}:latest + with_items: + - "{{ openshift.common.cli_image }}" + ############################################################################### # Upgrade Masters ############################################################################### -- cgit v1.2.3