Skip to content

Commit

Permalink
Merge pull request openshift#4026 from ewolinetz/cherry_picks_15
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored May 8, 2017
2 parents f4a514a + 8b5dd3f commit 6c40279
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 13 deletions.
9 changes: 9 additions & 0 deletions roles/openshift_logging/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 18 additions & 4 deletions roles/openshift_logging/tasks/install_elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
- 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
vars:
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 }}"
Expand All @@ -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
Expand All @@ -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 }}"
Expand Down Expand Up @@ -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 }}"
Expand All @@ -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:
Expand All @@ -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 }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/openshift_logging/tasks/oc_apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"]
6 changes: 3 additions & 3 deletions roles/openshift_logging/tasks/set_es_storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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 }}"
Expand All @@ -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.*')
Expand Down
7 changes: 5 additions & 2 deletions roles/openshift_logging/tasks/update_master_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 9 additions & 0 deletions roles/openshift_metrics/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions roles/openshift_metrics/tasks/update_master_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6c40279

Please sign in to comment.