summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master_facts
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-12-08 12:55:41 -0500
committerGitHub <noreply@github.com>2016-12-08 12:55:41 -0500
commit16749761a312894d8ba1101917b7ebf430616812 (patch)
tree1cccc66e87939cb8faccad8ba197d1a54fc2c38e /roles/openshift_master_facts
parent09b3183997a65c2835a95cf8c38c28e3f20380a7 (diff)
parent7e8e98dad2adde361c7ecc6e7b043429bed6d77a (diff)
downloadopenshift-16749761a312894d8ba1101917b7ebf430616812.tar.gz
openshift-16749761a312894d8ba1101917b7ebf430616812.tar.bz2
openshift-16749761a312894d8ba1101917b7ebf430616812.tar.xz
openshift-16749761a312894d8ba1101917b7ebf430616812.zip
Merge pull request #2902 from dgoodwin/fix-metrics-url
Fix metricsPublicURL only being set correctly on first master.
Diffstat (limited to 'roles/openshift_master_facts')
-rw-r--r--roles/openshift_master_facts/tasks/main.yml30
-rw-r--r--roles/openshift_master_facts/vars/main.yml4
2 files changed, 28 insertions, 6 deletions
diff --git a/roles/openshift_master_facts/tasks/main.yml b/roles/openshift_master_facts/tasks/main.yml
index e1cd94d75..f5923ecf8 100644
--- a/roles/openshift_master_facts/tasks/main.yml
+++ b/roles/openshift_master_facts/tasks/main.yml
@@ -1,4 +1,32 @@
---
+
+# Ensure the default sub-domain is set:
+- name: Migrate legacy osm_default_subdomain fact
+ set_fact:
+ openshift_master_default_subdomain: "{{ osm_default_subdomain | default(None) }}"
+ when: openshift_master_default_subdomain is not defined
+
+- fail:
+ msg: openshift_master_default_subdomain must be set to deploy metrics
+ when: openshift_hosted_metrics_deploy | default(false) | bool and openshift_master_default_subdomain | default("") == ""
+
+# NOTE: These metrics variables are unfortunately needed by both the master and the metrics roles
+# to properly configure the master-config.yaml file.
+#
+# NOTE: Today only changing the hostname for the metrics public URL is supported, the
+# path must stay consistent. As such if openshift_hosted_metrics_public_url is set in
+# inventory, we extract the hostname, and then reset openshift_hosted_metrics_public_url
+# to the format that we know is valid. (This may change in future)
+- set_fact:
+ g_metrics_hostname: "{{ openshift_hosted_metrics_public_url
+ | default('hawkular-metrics.' ~ (openshift_master_default_subdomain))
+ | oo_hostname_from_url }}"
+ when: openshift_hosted_metrics_deploy | default(false) | bool
+
+- set_fact:
+ openshift_hosted_metrics_public_url: "https://{{ g_metrics_hostname }}/hawkular/metrics"
+ when: openshift_hosted_metrics_deploy | default(false) | bool
+
- name: Set master facts
openshift_facts:
role: master
@@ -49,7 +77,6 @@
oauth_grant_method: "{{ openshift_master_oauth_grant_method | default(None) }}"
sdn_cluster_network_cidr: "{{ osm_cluster_network_cidr | default(None) }}"
sdn_host_subnet_length: "{{ osm_host_subnet_length | default(None) }}"
- default_subdomain: "{{ openshift_master_default_subdomain | default(osm_default_subdomain | default(None), true) }}"
custom_cors_origins: "{{ osm_custom_cors_origins | default(None) }}"
default_node_selector: "{{ osm_default_node_selector | default(None) }}"
project_request_message: "{{ osm_project_request_message | default(None) }}"
@@ -75,7 +102,6 @@
api_env_vars: "{{ openshift_master_api_env_vars | default(None) }}"
controllers_env_vars: "{{ openshift_master_controllers_env_vars | default(None) }}"
audit_config: "{{ openshift_master_audit_config | default(None) }}"
- metrics_public_url: "{% if openshift_hosted_metrics_deploy | default(false) %}https://{{ metrics_hostname }}/hawkular/metrics{% endif %}"
scheduler_args: "{{ openshift_master_scheduler_args | default(None) }}"
- name: Determine if scheduler config present
diff --git a/roles/openshift_master_facts/vars/main.yml b/roles/openshift_master_facts/vars/main.yml
index 3f328dcfe..a5ad580e7 100644
--- a/roles/openshift_master_facts/vars/main.yml
+++ b/roles/openshift_master_facts/vars/main.yml
@@ -24,7 +24,3 @@ builddefaults_yaml:
- name: no_proxy
value: "{{ openshift.master.builddefaults_no_proxy | default(omit, true) | join(',') }}"
-metrics_hostname: "{{ openshift_hosted_metrics_public_url
- | default('hawkular-metrics.' ~ (openshift.master.default_subdomain
- | default(openshift_master_default_subdomain )))
- | oo_hostname_from_url }}"