diff options
| author | Michael Gugino <mgugino@redhat.com> | 2017-10-10 13:10:23 -0400 | 
|---|---|---|
| committer | Michael Gugino <mgugino@redhat.com> | 2017-10-11 11:45:04 -0400 | 
| commit | bb1d5f45255d60a88a3220ea7e7b724a073465b1 (patch) | |
| tree | 7917fefb2a817c3f5446c8c6f8d489526651ee1c /roles/openshift_master | |
| parent | c38f63cc4a7e8cf2942e5bc83ee92fbea7aa59fe (diff) | |
| download | openshift-bb1d5f45255d60a88a3220ea7e7b724a073465b1.tar.gz openshift-bb1d5f45255d60a88a3220ea7e7b724a073465b1.tar.bz2 openshift-bb1d5f45255d60a88a3220ea7e7b724a073465b1.tar.xz openshift-bb1d5f45255d60a88a3220ea7e7b724a073465b1.zip | |
Fix broken debug_level
Currently, debug_level is documented as a way to change
the debug output level for both masters and nodes.
debug_level does not currently have any effect.
This commit removes debug_level from openshift_facts
and properly sets openshift_master_debug_level and
openshift_node_debug_level to the value of debug_level
specified in the inventory.
This commit also reorganizes some set_fact tasks
needed during master upgrades to put all work-around
set-facts for undefined variables in one place, allowing
for easier cleanup in the future.  This includes an
entry for openshift_master_debug_level.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1500164
Diffstat (limited to 'roles/openshift_master')
7 files changed, 51 insertions, 40 deletions
| diff --git a/roles/openshift_master/defaults/main.yml b/roles/openshift_master/defaults/main.yml index 73e935d3f..7e62a8c6d 100644 --- a/roles/openshift_master/defaults/main.yml +++ b/roles/openshift_master/defaults/main.yml @@ -1,4 +1,9 @@  --- +# openshift_master_defaults_in_use is a workaround to detect if we are consuming +# the plays from the role or outside of the role. +openshift_master_defaults_in_use: True +openshift_master_debug_level: "{{ debug_level | default(2) }}" +  r_openshift_master_firewall_enabled: "{{ os_firewall_enabled | default(True) }}"  r_openshift_master_use_firewalld: "{{ os_firewall_use_firewalld | default(False) }}" @@ -26,6 +31,9 @@ oreg_auth_credentials_path: "{{ r_openshift_master_data_dir }}/.docker"  oreg_auth_credentials_replace: False  l_bind_docker_reg_auth: False +containerized_svc_dir: "/usr/lib/systemd/system" +ha_svc_template_path: "native-cluster" +  # NOTE  # r_openshift_master_*_default may be defined external to this role.  # openshift_use_*, if defined, may affect other roles or play behavior. diff --git a/roles/openshift_master/tasks/registry_auth.yml b/roles/openshift_master/tasks/registry_auth.yml index 2644f235e..63d483760 100644 --- a/roles/openshift_master/tasks/registry_auth.yml +++ b/roles/openshift_master/tasks/registry_auth.yml @@ -1,14 +1,4 @@  --- -# We need to setup some variables as this play might be called directly -# from outside of the role. -- set_fact: -    oreg_auth_credentials_path: "{{ r_openshift_master_data_dir }}/.docker" -  when: oreg_auth_credentials_path is not defined - -- set_fact: -    oreg_host: "{{ oreg_url.split('/')[0] if (oreg_url is defined and '.' in oreg_url.split('/')[0]) else '' }}" -  when: oreg_host is not defined -  - name: Check for credentials file for registry auth    stat:      path: "{{ oreg_auth_credentials_path }}" diff --git a/roles/openshift_master/tasks/systemd_units.yml b/roles/openshift_master/tasks/systemd_units.yml index 8de62c59a..c6abaeb9b 100644 --- a/roles/openshift_master/tasks/systemd_units.yml +++ b/roles/openshift_master/tasks/systemd_units.yml @@ -1,31 +1,6 @@  --- -# This file is included both in the openshift_master role and in the upgrade -# playbooks.  For that reason the ha_svc variables are use set_fact instead of -# the vars directory on the role. - -# This play may be consumed outside the role, we need to ensure that -# openshift_master_config_dir is set. -- name: Set openshift_master_config_dir if unset -  set_fact: -    openshift_master_config_dir: '/etc/origin/master' -  when: openshift_master_config_dir is not defined - -# This play may be consumed outside the role, we need to ensure that -# r_openshift_master_data_dir is set. -- name: Set r_openshift_master_data_dir if unset -  set_fact: -    r_openshift_master_data_dir: "{{ openshift_data_dir | default('/var/lib/origin') }}" -  when: r_openshift_master_data_dir is not defined - -- include: registry_auth.yml - -- name: Remove the legacy master service if it exists -  include: clean_systemd_units.yml - -- name: Init HA Service Info -  set_fact: -    containerized_svc_dir: "/usr/lib/systemd/system" -    ha_svc_template_path: "native-cluster" +- include: upgrade_facts.yml +  when: openshift_master_defaults_in_use is not defined  - name: Set HA Service Info for containerized installs    set_fact: @@ -34,6 +9,11 @@    when:    - openshift.common.is_containerized | bool +- include: registry_auth.yml + +- name: Remove the legacy master service if it exists +  include: clean_systemd_units.yml +  # This is the image used for both HA and non-HA clusters:  - name: Pre-pull master image    command: > diff --git a/roles/openshift_master/tasks/upgrade_facts.yml b/roles/openshift_master/tasks/upgrade_facts.yml new file mode 100644 index 000000000..f6ad438aa --- /dev/null +++ b/roles/openshift_master/tasks/upgrade_facts.yml @@ -0,0 +1,33 @@ +--- +# This file exists because we call systemd_units.yml from outside of the role +# during upgrades.  When we remove this pattern, we can probably +# eliminate most of these set_fact items. + +- name: Set openshift_master_config_dir if unset +  set_fact: +    openshift_master_config_dir: '/etc/origin/master' +  when: openshift_master_config_dir is not defined + +- name: Set r_openshift_master_data_dir if unset +  set_fact: +    r_openshift_master_data_dir: "{{ openshift_data_dir | default('/var/lib/origin') }}" +  when: r_openshift_master_data_dir is not defined + +- set_fact: +    oreg_auth_credentials_path: "{{ r_openshift_master_data_dir }}/.docker" +  when: oreg_auth_credentials_path is not defined + +- set_fact: +    oreg_host: "{{ oreg_url.split('/')[0] if (oreg_url is defined and '.' in oreg_url.split('/')[0]) else '' }}" +  when: oreg_host is not defined + +- name: Set openshift_master_debug_level +  set_fact: +    openshift_master_debug_level: "{{ debug_level | default(2) }}" +  when: +  - openshift_master_debug_level is not defined + +- name: Init HA Service Info +  set_fact: +    containerized_svc_dir: "{{ containerized_svc_dir | default('/usr/lib/systemd/system') }}" +    ha_svc_template_path: "{{ ha_svc_template_path | default('native-cluster') }}" diff --git a/roles/openshift_master/templates/atomic-openshift-master.j2 b/roles/openshift_master/templates/atomic-openshift-master.j2 index b931f1414..7ec26ceb7 100644 --- a/roles/openshift_master/templates/atomic-openshift-master.j2 +++ b/roles/openshift_master/templates/atomic-openshift-master.j2 @@ -1,4 +1,4 @@ -OPTIONS=--loglevel={{ openshift.master.debug_level | default(2) }} +OPTIONS=--loglevel={{ openshift_master_debug_level }}  CONFIG_FILE={{ openshift_master_config_file }}  {# Preserve existing OPENSHIFT_DEFAULT_REGISTRY settings in scale up runs #}  {% if openshift_master_is_scaleup_host %} diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 index 63eb3ea1b..cc21b37af 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-api.j2 @@ -1,4 +1,4 @@ -OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.api_port }} --master={{ openshift.master.loopback_api_url }} +OPTIONS=--loglevel={{ openshift_master_debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.api_port }} --master={{ openshift.master.loopback_api_url }}  CONFIG_FILE={{ openshift_master_config_file }}  {# Preserve existing OPENSHIFT_DEFAULT_REGISTRY settings in scale up runs #}  {% if openshift_master_is_scaleup_host %} diff --git a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 index 0adfd05b6..493fc510e 100644 --- a/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 +++ b/roles/openshift_master/templates/native-cluster/atomic-openshift-master-controllers.j2 @@ -1,4 +1,4 @@ -OPTIONS=--loglevel={{ openshift.master.debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.controllers_port }} +OPTIONS=--loglevel={{ openshift_master_debug_level }} --listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://{{ openshift.master.bind_addr }}:{{ openshift.master.controllers_port }}  CONFIG_FILE={{ openshift_master_config_file }}  {# Preserve existing OPENSHIFT_DEFAULT_REGISTRY settings in scale up runs #}  {% if openshift_master_is_scaleup_host %} | 
