|
@@ -26,26 +26,64 @@
|
|
|
selector: "logging-infra,provider=openshift"
|
|
|
register: _logging_dcs
|
|
|
|
|
|
-- assert:
|
|
|
- that:
|
|
|
- - _logging_dcs.results.results[0]['items'] | map(attribute='metadata.namespace') | list | unique | count <= 1
|
|
|
- msg: "Found aggregated logging deploymentconfigs in multiple namespaces which is not supported"
|
|
|
- when:
|
|
|
- - _logging_dcs is defined
|
|
|
- - _logging_dcs.results | count > 0
|
|
|
-
|
|
|
- set_fact:
|
|
|
- _logging_namespace: "{{ _logging_dcs.results.results[0]['items'] | map(attribute='metadata.namespace') | list | unique | join('') }}"
|
|
|
+ _current_logging_namespace: "{{ _logging_dcs.results.results[0]['items'] | map(attribute='metadata.namespace') | list | unique | join(' ') }}"
|
|
|
when:
|
|
|
- _logging_dcs is defined
|
|
|
- _logging_dcs.results | count > 0
|
|
|
- _logging_dcs.results.results | count > 0
|
|
|
|
|
|
-- debug:
|
|
|
- msg: "Using the namespace '{{ _logging_namespace }}' which has an existing deployment"
|
|
|
- when:
|
|
|
+- when:
|
|
|
+ - logging_disable_namespace_check | default(false) | bool
|
|
|
- _logging_namespace is defined
|
|
|
- - _logging_namespace | count > 0
|
|
|
+ - _current_logging_namespace.split(" ") | count > 0
|
|
|
+ - _current_logging_namespace != ''
|
|
|
+ - _logging_namespace != _current_logging_namespace
|
|
|
+ block:
|
|
|
+ - name: Set Logging message about installing in multiple namespaces
|
|
|
+ run_once: true
|
|
|
+ set_stats:
|
|
|
+ data:
|
|
|
+ installer_phase_logging:
|
|
|
+ message: "Aggregated logging installed in multiple namespaces: \
|
|
|
+ current namespace(s): {{ _current_logging_namespace }} \
|
|
|
+ specified namespace: {{ _logging_namespace | default(_current_logging_namespace) }}"
|
|
|
+
|
|
|
+ - debug:
|
|
|
+ msg: "Aggregated logging installed in multiple namespaces: \
|
|
|
+ current namespace(s): {{ _current_logging_namespace }} \
|
|
|
+ specified namespace: {{ _logging_namespace | default(_current_logging_namespace) }}"
|
|
|
+
|
|
|
+- when: not logging_disable_namespace_check | default(false) | bool
|
|
|
+ block:
|
|
|
+ - assert:
|
|
|
+ that:
|
|
|
+ - _current_logging_namespace.split(" ") | count <= 1
|
|
|
+ - not _logging_namespace is defined or not _current_logging_namespace or _logging_namespace == _current_logging_namespace
|
|
|
+ msg: "Configuring aggregated logging in multiple namespaces is not supported: \
|
|
|
+ current namespace(s): {{ _current_logging_namespace }} \
|
|
|
+ specified namespace: {{ _logging_namespace | default(_current_logging_namespace) }}"
|
|
|
+
|
|
|
+ - debug:
|
|
|
+ msg: "Using the namespace '{{ _current_logging_namespace }}' which has an existing deployment"
|
|
|
+ when:
|
|
|
+ - _current_logging_namespace is defined
|
|
|
+ - _current_logging_namespace != ''
|
|
|
+
|
|
|
+ - set_fact:
|
|
|
+ _logging_namespace: "{{ _current_logging_namespace if _current_logging_namespace else _logging_namespace | default('openshift-logging') }}"
|
|
|
+
|
|
|
+- when:
|
|
|
+ - logging_disable_namespace_check | default(false) | bool
|
|
|
+ - not _logging_namespace is defined
|
|
|
+ block:
|
|
|
+ - assert:
|
|
|
+ that:
|
|
|
+ - _current_logging_namespace.split(" ") | count == 1
|
|
|
+ msg: "Multiple aggregated logging installations found in [{{ _current_logging_namespace }}], please specify which to use with _logging_namespace"
|
|
|
+
|
|
|
+ - set_fact:
|
|
|
+ _logging_namespace: "{{ _current_logging_namespace }}"
|
|
|
|
|
|
- set_fact:
|
|
|
openshift_logging_namespace: "{{ _logging_namespace if _logging_namespace else 'openshift-logging' }}"
|