Skip to content

Commit

Permalink
Pre-pull master/node/ovs images during upgrade.
Browse files Browse the repository at this point in the history
We did this for install but not upgrade, leading to situations where the
service restarts after upgrade could take much longer than expected as
docker pulls down the new image. Now the images are present when we
restart services and should allow them to come back online much more
quickly, equivalent to rpm service restarts.
  • Loading branch information
dgoodwin committed Dec 8, 2016
1 parent b5b664d commit ab14b72
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
7 changes: 0 additions & 7 deletions roles/openshift_master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@
action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }} state=present"
when: not openshift.common.is_containerized | bool

- name: Pull master image
command: >
docker pull {{ openshift.master.master_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
when: openshift.common.is_containerized | bool

- name: Create openshift.common.data_dir
file:
path: "{{ openshift.common.data_dir }}"
Expand Down
8 changes: 8 additions & 0 deletions roles/openshift_master/tasks/systemd_units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
ha_svc_template_path: "docker-cluster"
when: openshift.common.is_containerized | bool

# This is the image used for both HA and non-HA clusters:
- name: Pre-pull master image
command: >
docker pull {{ openshift.master.master_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
when: openshift.common.is_containerized | bool

# workaround for missing systemd unit files
- name: Create the systemd unit files
template:
Expand Down
14 changes: 0 additions & 14 deletions roles/openshift_node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@
action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-sdn-ovs{{ openshift_pkg_version | oo_image_tag_to_rpm_version(include_dash=True) }} state=present"
when: openshift.common.use_openshift_sdn and not openshift.common.is_containerized | bool

- name: Pull node image
command: >
docker pull {{ openshift.node.node_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
when: openshift.common.is_containerized | bool

- name: Pull OpenVSwitch image
command: >
docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool

- name: Install the systemd units
include: systemd_units.yml

Expand Down
14 changes: 14 additions & 0 deletions roles/openshift_node/tasks/systemd_units.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# This file is included both in the openshift_master role and in the upgrade
# playbooks.

- name: Pre-pull node image
command: >
docker pull {{ openshift.node.node_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
when: openshift.common.is_containerized | bool

- name: Pre-pull openvswitch image
command: >
docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }}
register: pull_result
changed_when: "'Downloaded newer image' in pull_result.stdout"
when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | bool

- name: Install Node dependencies docker service file
template:
dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node-dep.service"
Expand Down

0 comments on commit ab14b72

Please sign in to comment.