Bug 1529070

Summary: Fail to upgrade master due to fact openshift_upgrade_target not set on nodes hosts
Product: OpenShift Container Platform Reporter: liujia <jiajliu>
Component: Cluster Version OperatorAssignee: Michael Gugino <mgugino>
Status: CLOSED ERRATA QA Contact: liujia <jiajliu>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.8.0CC: aos-bugs, jialiu, jokerman, mmccomas, wmeng
Target Milestone: ---   
Target Release: 3.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-28 14:16:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description liujia 2017-12-26 09:12:59 UTC
Description of problem:
Run upgrade_control_plane playbook against rpm cluster from v3.7 to v3.8. Upgrade failed at TASK [openshift_version : set_fact] due to fact openshift_upgrade_target is not set on dedicated nodes hosts.

TASK [openshift_version : set_fact] ********************************************
task path: /usr/share/ansible/openshift-ansible/roles/openshift_version/tasks/main.yml:25
skipping: [-master-etcd-2.] => {
    "changed": false, 
    "skip_reason": "Conditional result was False", 
    "skipped": true
}
skipping: [-master-etcd-3.] => {
    "changed": false, 
    "skip_reason": "Conditional result was False", 
    "skipped": true
}
fatal: [-node-registry-router-1.]: FAILED! => {
    "failed": true, 
    "msg": "The conditional check 'openshift_release is defined' failed. The error was: error while evaluating conditional (openshift_release is defined): {{ openshift_upgrade_target }}: 'openshift_upgrade_target' is undefined\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/openshift_version/tasks/main.yml': line 25, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# Normalize some values that we need in a certain format that might be confusing:\n- set_fact:\n  ^ here\n"
}
...

===========debug info
No dedicated nodes in hosts group of upgrade_control_plane.yml, but required in version.yml.
# vim playbooks/common/openshift-cluster/upgrades/v3_8/upgrade_control_plane.yml
- name: Configure the upgrade target for the common upgrade tasks
  hosts: oo_masters_to_config:oo_etcd_to_config:oo_lb_to_config
  tasks:
  - set_fact:
      openshift_upgrade_target: '3.8'
      openshift_upgrade_min: '3.7'

# vim playbooks/init/version.yml
- name: Set openshift_version for etcd, node, and master hosts
  hosts: oo_etcd_to_config:oo_nodes_to_config:oo_masters_to_config:!oo_first_master
  vars:
    openshift_version: "{{ hostvars[groups.oo_first_master.0].openshift_version }}"
  pre_tasks:
  - set_fact:
      openshift_pkg_version: -{{ openshift_version }}
    when: openshift_pkg_version is not defined
  - debug: msg="openshift_pkg_version set to {{ openshift_pkg_version }}"
  roles:
  - openshift_version




Version-Release number of the following components:
ansible-2.4.1.0-1.el7.noarch
openshift-ansible-3.8.22-1.git.0.b4a1220.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. RPM install ocp v3.7
2. Upgrade masters
/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/upgrades/v3_8/upgrade_control_plane.yml
3.

Actual results:
Upgrade failed.

Expected results:
Upgrade succeed.

Additional info:
Please attach logs from ansible-playbook with the -vvv flag

Comment 1 Michael Gugino 2018-01-02 19:04:28 UTC
We are refactoring openshift_version role at the moment.

The fix for this will be when we update openshift_version and other init steps to account for only control plane hosts during upgrades.

Current workaround would be to set 'openshift_upgrade_target' in inventory until that code is merged.

I will update here when we get a patch out to address.

Comment 2 Michael Gugino 2018-01-23 20:26:44 UTC
The previously mentioned refactoring has taken place.  This is ready to verify.

Comment 3 Michael Gugino 2018-01-24 15:12:17 UTC
This PR contains some of the work that was responsible for this bug: https://github.com/openshift/openshift-ansible/pull/6784

Comment 5 Johnny Liu 2018-01-25 05:41:05 UTC
This bug is targeted for 3.9, while this bug is attached to a 3.5/3.6/3.7 errata, pls attach it to a correct errata.

Comment 8 liujia 2018-01-30 07:44:53 UTC
Verified on openshift-ansible-3.9.0-0.31.0.git.0.e0a0ad8.el7.noarch

Comment 11 errata-xmlrpc 2018-03-28 14:16:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0489