Ver Fonte

Remove master_ha bool checks

Most of these checks are no longer applicable to
the tasks on which they are applied.

This commit removes incorrect ha checks to ensure
services are restarted at appropriate times.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1500897
Michael Gugino há 7 anos atrás
pai
commit
4f7d963986

+ 0 - 2
playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml

@@ -48,8 +48,6 @@
 # support for optional hooks to be defined.
 # support for optional hooks to be defined.
 - name: Upgrade master
 - name: Upgrade master
   hosts: oo_masters_to_config
   hosts: oo_masters_to_config
-  vars:
-    openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}"
   serial: 1
   serial: 1
   roles:
   roles:
   - openshift_facts
   - openshift_facts

+ 0 - 1
playbooks/openshift-master/private/additional_config.yml

@@ -16,7 +16,6 @@
   vars:
   vars:
     cockpit_plugins: "{{ osm_cockpit_plugins | default(['cockpit-kubernetes']) }}"
     cockpit_plugins: "{{ osm_cockpit_plugins | default(['cockpit-kubernetes']) }}"
     etcd_urls: "{{ openshift.master.etcd_urls }}"
     etcd_urls: "{{ openshift.master.etcd_urls }}"
-    openshift_master_ha: "{{ groups.oo_masters | length > 1 }}"
     omc_cluster_hosts: "{{ groups.oo_masters | join(' ')}}"
     omc_cluster_hosts: "{{ groups.oo_masters | join(' ')}}"
   roles:
   roles:
   - role: openshift_project_request_template
   - role: openshift_project_request_template

+ 1 - 2
playbooks/openshift-master/private/config.yml

@@ -78,7 +78,6 @@
         console_url: "{{ openshift_master_console_url | default(None) }}"
         console_url: "{{ openshift_master_console_url | default(None) }}"
         console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
         console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
         public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
         public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
-        ha: "{{ openshift_master_ha | default(groups.oo_masters | length > 1) }}"
         master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}"
         master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}"
 
 
 - name: Inspect state of first master config settings
 - name: Inspect state of first master config settings
@@ -166,7 +165,6 @@
   hosts: oo_masters_to_config
   hosts: oo_masters_to_config
   any_errors_fatal: true
   any_errors_fatal: true
   vars:
   vars:
-    openshift_master_ha: "{{ openshift.master.ha }}"
     openshift_master_count: "{{ openshift.master.master_count }}"
     openshift_master_count: "{{ openshift.master.master_count }}"
     openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}"
     openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}"
     openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
     openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
@@ -186,6 +184,7 @@
   - role: openshift_buildoverrides
   - role: openshift_buildoverrides
   - role: nickhammond.logrotate
   - role: nickhammond.logrotate
   - role: openshift_master
   - role: openshift_master
+    openshift_master_ha: "{{ (groups.oo_masters | length > 1) | bool }}"
     openshift_master_hosts: "{{ groups.oo_masters_to_config }}"
     openshift_master_hosts: "{{ groups.oo_masters_to_config }}"
     r_openshift_master_clean_install: "{{ hostvars[groups.oo_first_master.0].l_clean_install }}"
     r_openshift_master_clean_install: "{{ hostvars[groups.oo_first_master.0].l_clean_install }}"
     r_openshift_master_etcd3_storage: "{{ hostvars[groups.oo_first_master.0].l_etcd3_enabled }}"
     r_openshift_master_etcd3_storage: "{{ hostvars[groups.oo_first_master.0].l_etcd3_enabled }}"

+ 3 - 6
playbooks/openshift-master/private/restart.yml

@@ -3,16 +3,13 @@
 
 
 - name: Restart masters
 - name: Restart masters
   hosts: oo_masters_to_config
   hosts: oo_masters_to_config
-  vars:
-    openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}"
   serial: 1
   serial: 1
-  handlers:
-  - import_tasks: ../../../roles/openshift_master/handlers/main.yml
   roles:
   roles:
   - openshift_facts
   - openshift_facts
   post_tasks:
   post_tasks:
   - include_tasks: tasks/restart_hosts.yml
   - include_tasks: tasks/restart_hosts.yml
     when: openshift_rolling_restart_mode | default('services') == 'system'
     when: openshift_rolling_restart_mode | default('services') == 'system'
-
-  - include_tasks: tasks/restart_services.yml
+  - import_role:
+      name: openshift_master
+      tasks_from: restart.yml
     when: openshift_rolling_restart_mode | default('services') == 'services'
     when: openshift_rolling_restart_mode | default('services') == 'services'

+ 0 - 1
playbooks/openshift-master/private/scaleup.yml

@@ -8,7 +8,6 @@
   - openshift_facts:
   - openshift_facts:
       role: master
       role: master
       local_facts:
       local_facts:
-        ha: "{{ openshift_master_ha | default(groups.oo_masters | length > 1) }}"
         master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}"
         master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}"
   - name: Update master count
   - name: Update master count
     modify_yaml:
     modify_yaml:

+ 0 - 4
playbooks/openshift-master/private/tasks/restart_services.yml

@@ -1,4 +0,0 @@
----
-- import_role:
-    name: openshift_master
-    tasks_from: restart.yml

+ 2 - 6
roles/nuage_master/handlers/main.yaml

@@ -1,9 +1,7 @@
 ---
 ---
 - name: restart master api
 - name: restart master api
   systemd: name={{ openshift_service_type }}-master-api state=restarted
   systemd: name={{ openshift_service_type }}-master-api state=restarted
-  when: >
-    (openshift_master_ha | bool) and
-    (not master_api_service_status_changed | default(false))
+  when: (not master_api_service_status_changed | default(false))
 
 
 # TODO: need to fix up ignore_errors here
 # TODO: need to fix up ignore_errors here
 # We retry the controllers because the API may not be 100% initialized yet.
 # We retry the controllers because the API may not be 100% initialized yet.
@@ -13,7 +11,5 @@
   delay: 5
   delay: 5
   register: result
   register: result
   until: result.rc == 0
   until: result.rc == 0
-  when: >
-    (openshift_master_ha | bool) and
-    (not master_controllers_service_status_changed | default(false))
+  when: (not master_controllers_service_status_changed | default(false))
   ignore_errors: yes
   ignore_errors: yes

+ 1 - 1
roles/openshift_master/tasks/main.yml

@@ -227,7 +227,7 @@
 - pause:
 - pause:
     seconds: 15
     seconds: 15
   when:
   when:
-  - openshift.master.ha | bool
+  - openshift_master_ha | bool
 
 
 - name: Start and enable master api all masters
 - name: Start and enable master api all masters
   systemd:
   systemd:

+ 7 - 10
roles/openshift_master/tasks/restart.yml

@@ -3,7 +3,6 @@
   service:
   service:
     name: "{{ openshift_service_type }}-master-api"
     name: "{{ openshift_service_type }}-master-api"
     state: restarted
     state: restarted
-  when: openshift_master_ha | bool
 - name: Wait for master API to come back online
 - name: Wait for master API to come back online
   wait_for:
   wait_for:
     host: "{{ openshift.common.hostname }}"
     host: "{{ openshift.common.hostname }}"
@@ -11,12 +10,10 @@
     delay: 10
     delay: 10
     port: "{{ openshift.master.api_port }}"
     port: "{{ openshift.master.api_port }}"
     timeout: 600
     timeout: 600
-  when: openshift_master_ha | bool
-- name: Restart master controllers
-  service:
-    name: "{{ openshift_service_type }}-master-controllers"
-    state: restarted
-  # Ignore errrors since it is possible that type != simple for
-  # pre-3.1.1 installations.
-  ignore_errors: true
-  when: openshift_master_ha | bool
+# We retry the controllers because the API may not be 100% initialized yet.
+- name: restart master controllers
+  command: "systemctl restart {{ openshift_service_type }}-master-controllers"
+  retries: 3
+  delay: 5
+  register: result
+  until: result.rc == 0