summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Castro <spinolacastro@gmail.com>2015-08-17 17:38:23 -0300
committerDiego Castro <spinolacastro@gmail.com>2015-08-17 17:38:23 -0300
commit8468d25fae71c80277c10ad975641cb1ba230fd8 (patch)
tree3e133c06cb9c015208845f50fbb1131d003705f4
parent7f740ff24b807f9f88209785a027056bfa146e2e (diff)
downloadopenshift-8468d25fae71c80277c10ad975641cb1ba230fd8.tar.gz
openshift-8468d25fae71c80277c10ad975641cb1ba230fd8.tar.bz2
openshift-8468d25fae71c80277c10ad975641cb1ba230fd8.tar.xz
openshift-8468d25fae71c80277c10ad975641cb1ba230fd8.zip
Get default values from openshift_facts
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py28
-rw-r--r--roles/openshift_master/templates/master.yaml.v1.j212
2 files changed, 34 insertions, 6 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 4e0989c5f..97a839e8e 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -323,6 +323,33 @@ def set_fluentd_facts_if_unset(facts):
facts['common']['use_fluentd'] = use_fluentd
return facts
+def set_project_config_facts_if_unset(facts):
+ """ Set Project Configuration facts if not already present in facts dict
+ dict:
+ Args:
+ facts (dict): existing facts
+ Returns:
+ dict: the facts dict updated with the generated Project Configuration
+ facts if they were not already present
+
+ """
+
+ config={
+ 'default_node_selector': '',
+ 'project_request_message': '',
+ 'project_request_template': '',
+ 'mcs_allocator_range': 's0:/2',
+ 'mcs_labels_per_project': 5,
+ 'uid_allocator_range': '1000000000-1999999999/10000'
+ }
+
+ if 'master' in facts:
+ for key,value in config.items():
+ if key not in facts['master']:
+ facts['master'][key] = value
+
+ return facts
+
def set_identity_providers_if_unset(facts):
""" Set identity_providers fact if not already present in facts dict
@@ -699,6 +726,7 @@ class OpenShiftFacts(object):
facts = merge_facts(facts, local_facts)
facts['current_config'] = get_current_config(facts)
facts = set_url_facts_if_unset(facts)
+ facts = set_project_config_facts_if_unset(facts)
facts = set_fluentd_facts_if_unset(facts)
facts = set_identity_providers_if_unset(facts)
facts = set_registry_url_if_unset(facts)
diff --git a/roles/openshift_master/templates/master.yaml.v1.j2 b/roles/openshift_master/templates/master.yaml.v1.j2
index b738084c0..7a8ab5c00 100644
--- a/roles/openshift_master/templates/master.yaml.v1.j2
+++ b/roles/openshift_master/templates/master.yaml.v1.j2
@@ -100,13 +100,13 @@ policyConfig:
openshiftInfrastructureNamespace: openshift-infra
openshiftSharedResourcesNamespace: openshift
projectConfig:
- defaultNodeSelector: "{{ openshift.master.default_node_selector | default("") }}"
- projectRequestMessage: "{{ openshift.master.project_request_message | default("") }}"
- projectRequestTemplate: "{{ openshift.master.project_request_template | default("") }}"
+ defaultNodeSelector: {{ openshift.master.default_node_selector }}
+ projectRequestMessage: {{ openshift.master.project_request_message }}
+ projectRequestTemplate: {{ openshift.master.project_request_template }}
securityAllocator:
- mcsAllocatorRange: "{{ openshift.master.project_request_template | default("s0:/2") }}"
- mcsLabelsPerProject: "{{ openshift.master.mcs_labels_per_project | default("5") }}"
- uidAllocatorRange: "{{ openshift.master.uid_allocator_range | default("1000000000-1999999999/10000") }}"
+ mcsAllocatorRange: {{ openshift.master.mcs_allocator_range }}
+ mcsLabelsPerProject: {{ openshift.master.mcs_labels_per_project }}
+ uidAllocatorRange: {{ openshift.master.uid_allocator_range }}
routingConfig:
subdomain: "{{ openshift.master.default_subdomain | default("") }}"
serviceAccountConfig: