From ec293f371046a99b0f737a59b4a9f3f001af3279 Mon Sep 17 00:00:00 2001 From: Diego Castro Date: Wed, 12 Aug 2015 20:02:05 -0300 Subject: Custom Project Config --- roles/openshift_facts/library/openshift_facts.py | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'roles/openshift_facts') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 4e0989c5f..0fde372ed 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -349,6 +349,33 @@ def set_identity_providers_if_unset(facts): return facts +def set_project_config_if_unset(facts): + """ Set project_config fact if not already present in facts dict + + Args: + facts (dict): existing facts + Returns: + dict: the facts dict updated with the generated identity providers + facts if they were not already present + """ + if 'master' in facts: + if 'project_config' not in facts['master']: + config = dict( + projectConfig=dict( + defaultNodeSelector='', + projectRequestMessage='', + projectRequestTemplate='', + securityAllocator=dict( + mcsAllocatorRange='s0:/2', + mcsLabelsPerProject=5, + uidAllocatorRange='1000000000-1999999999/10000' + ) + ) + ) + facts['master']['project_config'] = [config] + + return facts + def set_url_facts_if_unset(facts): """ Set url facts if not already present in facts dict @@ -700,6 +727,7 @@ class OpenShiftFacts(object): facts['current_config'] = get_current_config(facts) facts = set_url_facts_if_unset(facts) facts = set_fluentd_facts_if_unset(facts) + facts = set_project_config_if_unset(facts) facts = set_identity_providers_if_unset(facts) facts = set_registry_url_if_unset(facts) facts = set_sdn_facts_if_unset(facts) -- cgit v1.2.3 From 0bc39b7f4ad53344d19d0d783fd6eec4d3b424ef Mon Sep 17 00:00:00 2001 From: Diego Castro Date: Wed, 12 Aug 2015 22:53:10 -0300 Subject: Update PR #458 from comments --- roles/openshift_facts/library/openshift_facts.py | 28 ------------------------ 1 file changed, 28 deletions(-) (limited to 'roles/openshift_facts') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 0fde372ed..4e0989c5f 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -349,33 +349,6 @@ def set_identity_providers_if_unset(facts): return facts -def set_project_config_if_unset(facts): - """ Set project_config fact if not already present in facts dict - - Args: - facts (dict): existing facts - Returns: - dict: the facts dict updated with the generated identity providers - facts if they were not already present - """ - if 'master' in facts: - if 'project_config' not in facts['master']: - config = dict( - projectConfig=dict( - defaultNodeSelector='', - projectRequestMessage='', - projectRequestTemplate='', - securityAllocator=dict( - mcsAllocatorRange='s0:/2', - mcsLabelsPerProject=5, - uidAllocatorRange='1000000000-1999999999/10000' - ) - ) - ) - facts['master']['project_config'] = [config] - - return facts - def set_url_facts_if_unset(facts): """ Set url facts if not already present in facts dict @@ -727,7 +700,6 @@ class OpenShiftFacts(object): facts['current_config'] = get_current_config(facts) facts = set_url_facts_if_unset(facts) facts = set_fluentd_facts_if_unset(facts) - facts = set_project_config_if_unset(facts) facts = set_identity_providers_if_unset(facts) facts = set_registry_url_if_unset(facts) facts = set_sdn_facts_if_unset(facts) -- cgit v1.2.3 From 8468d25fae71c80277c10ad975641cb1ba230fd8 Mon Sep 17 00:00:00 2001 From: Diego Castro Date: Mon, 17 Aug 2015 17:38:23 -0300 Subject: Get default values from openshift_facts --- roles/openshift_facts/library/openshift_facts.py | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'roles/openshift_facts') 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) -- cgit v1.2.3