Skip to content

Commit

Permalink
Merge pull request #5814 from mgugino-upstream-stage/docker-auth-upgr…
Browse files Browse the repository at this point in the history
…ades

Automatic merge from submit-queue.

Enable oreg_auth credential replace during upgrades

Currently, upgrades run a docker image pull prior to
upgrading masters and nodes for containerized installs.

If using a secure registry, and a user wishes to upgrade
their credentials due to expiry, the image pull will fail.

This commit ensures docker login credentials are updated
during upgrades, if necessary.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1503995
  • Loading branch information
openshift-merge-robot authored Oct 24, 2017
2 parents d9cfebd + 1f06906 commit abb5b1c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
msg: Verify OpenShift is already installed
when: openshift.common.version is not defined

- name: Update oreg_auth docker login credentials if necessary
include_role:
name: docker
tasks_from: registry_auth.yml
when: oreg_auth_user is defined

- name: Verify containers are available for upgrade
command: >
docker pull {{ openshift.common.cli_image }}:{{ openshift_image_tag }}
Expand Down
12 changes: 1 addition & 11 deletions roles/docker/tasks/package_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,6 @@
- set_fact:
docker_service_status_changed: "{{ (r_docker_package_docker_start_result | changed) and (r_docker_already_running_result.stdout != 'ActiveState=active' ) }}"

- name: Check for credentials file for registry auth
stat:
path: "{{ docker_cli_auth_config_path }}/config.json"
when: oreg_auth_user is defined
register: docker_cli_auth_credentials_stat

- name: Create credentials for docker cli registry auth
command: "docker --config={{ docker_cli_auth_config_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
when:
- oreg_auth_user is defined
- (not docker_cli_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
- include: registry_auth.yml

- meta: flush_handlers
12 changes: 12 additions & 0 deletions roles/docker/tasks/registry_auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Check for credentials file for registry auth
stat:
path: "{{ docker_cli_auth_config_path }}/config.json"
when: oreg_auth_user is defined
register: docker_cli_auth_credentials_stat

- name: Create credentials for docker cli registry auth
command: "docker --config={{ docker_cli_auth_config_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
when:
- oreg_auth_user is defined
- (not docker_cli_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool

0 comments on commit abb5b1c

Please sign in to comment.