Browse Source

Merge pull request #4026 from ewolinetz/cherry_picks_15

Merged by openshift-bot
OpenShift Bot 8 years ago
parent
commit
6c402798d6

+ 9 - 0
roles/openshift_logging/handlers/main.yml

@@ -4,6 +4,15 @@
   when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool))
   notify: Verify API Server
 
+- name: restart master api
+  systemd: name={{ openshift.common.service_type }}-master-api state=restarted
+  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_api_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native'
+  notify: Verify API Server
+
+- name: restart master controllers
+  systemd: name={{ openshift.common.service_type }}-master-controllers state=restarted
+  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_controllers_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native'
+
 - name: Verify API Server
   # Using curl here since the uri module requires python-httplib2 and
   # wait_for port doesn't provide health information.

+ 18 - 4
roles/openshift_logging/tasks/install_elasticsearch.yaml

@@ -5,6 +5,9 @@
 - set_fact: openshift_logging_es_pvc_prefix="logging-es"
   when: not openshift_logging_es_pvc_prefix or openshift_logging_es_pvc_prefix == ''
 
+- set_fact: es_indices={{ es_indices | default([]) + [item | int - 1] }}
+  with_sequence: count={{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count }}
+
 ### evaluate if the PVC attached to the dc currently matches the provided vars
 ## if it does then we reuse that pvc in the DC
 - include: set_es_storage.yaml
@@ -12,8 +15,9 @@
     es_component: es
     es_name: "{{ deployment.0 }}"
     es_spec: "{{ deployment.1 }}"
+    es_pvc_count: "{{ deployment.2 | int }}"
     es_node_selector: "{{ openshift_logging_es_nodeselector | default({}) }}"
-    es_pvc_names: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() }}"
+    es_pvc_names_count: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() | count }}"
     es_pvc_size: "{{ openshift_logging_es_pvc_size }}"
     es_pvc_prefix: "{{ openshift_logging_es_pvc_prefix }}"
     es_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic | bool }}"
@@ -23,6 +27,7 @@
   with_together:
   - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.keys() }}"
   - "{{ openshift_logging_facts.elasticsearch.deploymentconfigs.values() }}"
+  - "{{ es_indices | default([]) }}"
   loop_control:
     loop_var: deployment
 ## if it does not then we should create one that does and attach it
@@ -33,8 +38,9 @@
     es_component: es
     es_name: "logging-es-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"
     es_spec: "{}"
+    es_pvc_count: "{{ item | int - 1 }}"
     es_node_selector: "{{ openshift_logging_es_nodeselector | default({}) }}"
-    es_pvc_names: "{{ openshift_logging_facts.elasticsearch.pvcs.keys() }}"
+    es_pvc_names_count: "{{ [openshift_logging_facts.elasticsearch.pvcs.keys() | count, openshift_logging_facts.elasticsearch.deploymentconfigs.keys() | count] | max }}"
     es_pvc_size: "{{ openshift_logging_es_pvc_size }}"
     es_pvc_prefix: "{{ openshift_logging_es_pvc_prefix }}"
     es_pvc_dynamic: "{{ openshift_logging_es_pvc_dynamic | bool }}"
@@ -63,13 +69,19 @@
 - set_fact: openshift_logging_es_ops_pvc_prefix="logging-es-ops"
   when: not openshift_logging_es_ops_pvc_prefix or openshift_logging_es_ops_pvc_prefix == ''
 
+- set_fact: es_ops_indices={{ es_ops_indices | default([]) + [item | int - 1] }}
+  with_sequence: count={{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count }}
+  when:
+  - openshift_logging_use_ops | bool
+
 - include: set_es_storage.yaml
   vars:
     es_component: es-ops
     es_name: "{{ deployment.0 }}"
     es_spec: "{{ deployment.1 }}"
+    es_pvc_count: "{{ deployment.2 | int }}"
     es_node_selector: "{{ openshift_logging_es_ops_nodeselector | default({}) }}"
-    es_pvc_names: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() }}"
+    es_pvc_names_count: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() | count }}"
     es_pvc_size: "{{ openshift_logging_es_ops_pvc_size }}"
     es_pvc_prefix: "{{ openshift_logging_es_ops_pvc_prefix }}"
     es_pvc_dynamic: "{{ openshift_logging_es_ops_pvc_dynamic | bool }}"
@@ -79,6 +91,7 @@
   with_together:
   - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() }}"
   - "{{ openshift_logging_facts.elasticsearch_ops.deploymentconfigs.values() }}"
+  - "{{ es_ops_indices | default([]) }}"
   loop_control:
     loop_var: deployment
   when:
@@ -91,8 +104,9 @@
     es_component: es-ops
     es_name: "logging-es-ops-{{'abcdefghijklmnopqrstuvwxyz0123456789'|random_word(8)}}"
     es_spec: "{}"
+    es_pvc_count: "{{ item | int - 1 }}"
     es_node_selector: "{{ openshift_logging_es_ops_nodeselector | default({}) }}"
-    es_pvc_names: "{{ openshift_logging_facts.elasticsearch_ops.pvcs.keys() }}"
+    es_pvc_names_count: "{{ [openshift_logging_facts.elasticsearch_ops.pvcs.keys() | count, openshift_logging_facts.elasticsearch_ops.deploymentconfigs.keys() | count] | max }}"
     es_pvc_size: "{{ openshift_logging_es_ops_pvc_size }}"
     es_pvc_prefix: "{{ openshift_logging_es_ops_pvc_prefix }}"
     es_pvc_dynamic: "{{ openshift_logging_es_ops_pvc_dynamic | bool }}"

+ 2 - 2
roles/openshift_logging/tasks/oc_apply.yaml

@@ -6,7 +6,7 @@
     namespace: "{{ namespace }}"
     files:
     - "{{ file_name }}"
-  when: file_content.kind != "Service"
+  when: file_content.kind not in ["Service", "Route"]
 
 ## still need to do this for services until the template logic is replaced by oc_*
 - block:
@@ -49,4 +49,4 @@
     failed_when: "'error' in generation_apply.stderr"
     changed_when: generation_apply.rc == 0
     when: "'field is immutable' in generation_apply.stderr"
-  when: file_content.kind == "Service"
+  when: file_content.kind in ["Service", "Route"]

+ 3 - 3
roles/openshift_logging/tasks/set_es_storage.yaml

@@ -36,7 +36,7 @@
   - name: Generating PersistentVolumeClaims
     template: src=pvc.j2 dest={{mktemp.stdout}}/templates/logging-{{obj_name}}-pvc.yaml
     vars:
-      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names | count }}"
+      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names_count | int + es_pvc_count | int }}"
       size: "{{ es_pvc_size }}"
       access_modes: "{{ openshift_logging_storage_access_modes }}"
       pv_selector: "{{ es_pv_selector }}"
@@ -47,7 +47,7 @@
   - name: Generating PersistentVolumeClaims - Dynamic
     template: src=pvc.j2 dest={{mktemp.stdout}}/templates/logging-{{obj_name}}-pvc.yaml
     vars:
-      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names | count }}"
+      obj_name: "{{ es_pvc_prefix }}-{{ es_pvc_names_count | int + es_pvc_count | int }}"
       annotations:
         volume.alpha.kubernetes.io/storage-class: "dynamic"
       size: "{{ es_pvc_size }}"
@@ -57,7 +57,7 @@
     check_mode: no
     changed_when: no
 
-  - set_fact: es_storage_claim="{{ es_pvc_prefix }}-{{ es_pvc_names | count }}"
+  - set_fact: es_storage_claim="{{ es_pvc_prefix }}-{{ es_pvc_names_count | int + es_pvc_count | int }}"
 
   when:
   - es_pvc_size | search('^\d.*')

+ 5 - 2
roles/openshift_logging/tasks/update_master_config.yaml

@@ -4,6 +4,9 @@
     dest: "{{ openshift.common.config_base }}/master/master-config.yaml"
     yaml_key: assetConfig.loggingPublicURL
     yaml_value: "https://{{ openshift_logging_kibana_hostname }}"
-  notify: restart master
+  notify:
+  - restart master
+  - restart master api
+  - restart master controllers
   tags:
-    - update_master_config
+  - update_master_config

+ 9 - 0
roles/openshift_metrics/handlers/main.yml

@@ -4,6 +4,15 @@
   when: (openshift.master.ha is not defined or not openshift.master.ha | bool) and (not (master_service_status_changed | default(false) | bool))
   notify: Verify API Server
 
+- name: restart master api
+  systemd: name={{ openshift.common.service_type }}-master-api state=restarted
+  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_api_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native'
+  notify: Verify API Server
+
+- name: restart master controllers
+  systemd: name={{ openshift.common.service_type }}-master-controllers state=restarted
+  when: (openshift.master.ha is defined and openshift.master.ha | bool) and (not (master_controllers_service_status_changed | default(false) | bool)) and openshift.master.cluster_method == 'native'
+
 - name: Verify API Server
   # Using curl here since the uri module requires python-httplib2 and
   # wait_for port doesn't provide health information.

+ 5 - 2
roles/openshift_metrics/tasks/update_master_config.yaml

@@ -4,6 +4,9 @@
     dest: "{{ openshift.common.config_base }}/master/master-config.yaml"
     yaml_key: assetConfig.metricsPublicURL
     yaml_value: "https://{{ openshift_metrics_hawkular_hostname}}/hawkular/metrics"
-  notify: restart master
+  notify:
+  - restart master
+  - restart master api
+  - restart master controllers
   tags:
-    - update_master_config
+  - update_master_config