diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2016-12-01 12:37:20 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2016-12-01 12:37:20 -0400 |
commit | 7e8e98dad2adde361c7ecc6e7b043429bed6d77a (patch) | |
tree | 9a193f72094d77fae4369ec2a31f714c58e11a9f /roles/openshift_master_facts | |
parent | 4ff3ae5f8e99145a06a0cc9976ec07c008831b65 (diff) | |
download | openshift-7e8e98dad2adde361c7ecc6e7b043429bed6d77a.tar.gz openshift-7e8e98dad2adde361c7ecc6e7b043429bed6d77a.tar.bz2 openshift-7e8e98dad2adde361c7ecc6e7b043429bed6d77a.tar.xz openshift-7e8e98dad2adde361c7ecc6e7b043429bed6d77a.zip |
Fix metricsPublicURL only being set correctly on first master.
Problem was caused by facts not being set for that master. To fix this
patch cleans up the calculation of metricsPublicURL in general. Because
this value is used in openshift_master to template into the master
config file, we now define these facts more clearly in
openshift_master_facts, and add a dependency on this to
openshift_metrics.
The calculation of default sub-domain is also changed to remove it from
system facts (as neither of these are facts about the system) and
instead use plain variables.
Diffstat (limited to 'roles/openshift_master_facts')
-rw-r--r-- | roles/openshift_master_facts/tasks/main.yml | 30 | ||||
-rw-r--r-- | roles/openshift_master_facts/vars/main.yml | 4 |
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 170861484..12fa7f3be 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 }}" |