summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master_facts
diff options
context:
space:
mode:
authorRussell Teague <rteague@redhat.com>2017-01-31 08:05:03 -0500
committerGitHub <noreply@github.com>2017-01-31 08:05:03 -0500
commitfca215887b2e4224779b58e8fd1b7662ec993f83 (patch)
treea8862a16c39d54dc5f123fff532904da371794e1 /roles/openshift_master_facts
parente6bec56b75baa631cdb4902d29cca811db91e9f1 (diff)
parentbc2ba98351a4b45a18813cf2dc2cd58f098bc1d3 (diff)
downloadopenshift-fca215887b2e4224779b58e8fd1b7662ec993f83.tar.gz
openshift-fca215887b2e4224779b58e8fd1b7662ec993f83.tar.bz2
openshift-fca215887b2e4224779b58e8fd1b7662ec993f83.tar.xz
openshift-fca215887b2e4224779b58e8fd1b7662ec993f83.zip
Merge pull request #3194 from mtnbikenc/upgrade-3_5-fork
Create v3_5 upgrade playbooks
Diffstat (limited to 'roles/openshift_master_facts')
-rw-r--r--roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py84
-rw-r--r--roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py61
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py23
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py16
4 files changed, 137 insertions, 47 deletions
diff --git a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py
index 29a59a0d3..0c94228c6 100644
--- a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py
+++ b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_predicates.py
@@ -52,32 +52,64 @@ class LookupModule(LookupBase):
# convert short_version to origin short_version
short_version = re.sub('^3.', '1.', short_version)
- if short_version in ['1.1', '1.2']:
- predicates.append({'name': 'PodFitsHostPorts'})
- predicates.append({'name': 'PodFitsResources'})
-
- # applies to all known versions
- predicates.append({'name': 'NoDiskConflict'})
-
- # only 1.1 didn't include NoVolumeZoneConflict
- if short_version != '1.1':
- predicates.append({'name': 'NoVolumeZoneConflict'})
-
- if short_version in ['1.1', '1.2']:
- predicates.append({'name': 'MatchNodeSelector'})
-
- if short_version != '1.1':
- predicates.append({'name': 'MaxEBSVolumeCount'})
- predicates.append({'name': 'MaxGCEPDVolumeCount'})
-
- if short_version not in ['1.1', '1.2']:
- predicates.append({'name': 'GeneralPredicates'})
- predicates.append({'name': 'PodToleratesNodeTaints'})
- predicates.append({'name': 'CheckNodeMemoryPressure'})
-
- if short_version not in ['1.1', '1.2', '1.3']:
- predicates.append({'name': 'CheckNodeDiskPressure'})
- predicates.append({'name': 'MatchInterPodAffinity'})
+ # Predicates ordered according to OpenShift Origin source:
+ # origin/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
+
+ if short_version == '1.1':
+ predicates.extend([
+ {'name': 'PodFitsHostPorts'},
+ {'name': 'PodFitsResources'},
+ {'name': 'NoDiskConflict'},
+ {'name': 'MatchNodeSelector'},
+ ])
+
+ if short_version == '1.2':
+ predicates.extend([
+ {'name': 'PodFitsHostPorts'},
+ {'name': 'PodFitsResources'},
+ {'name': 'NoDiskConflict'},
+ {'name': 'NoVolumeZoneConflict'},
+ {'name': 'MatchNodeSelector'},
+ {'name': 'MaxEBSVolumeCount'},
+ {'name': 'MaxGCEPDVolumeCount'}
+ ])
+
+ if short_version == '1.3':
+ predicates.extend([
+ {'name': 'NoDiskConflict'},
+ {'name': 'NoVolumeZoneConflict'},
+ {'name': 'MaxEBSVolumeCount'},
+ {'name': 'MaxGCEPDVolumeCount'},
+ {'name': 'GeneralPredicates'},
+ {'name': 'PodToleratesNodeTaints'},
+ {'name': 'CheckNodeMemoryPressure'}
+ ])
+
+ if short_version == '1.4':
+ predicates.extend([
+ {'name': 'NoDiskConflict'},
+ {'name': 'NoVolumeZoneConflict'},
+ {'name': 'MaxEBSVolumeCount'},
+ {'name': 'MaxGCEPDVolumeCount'},
+ {'name': 'GeneralPredicates'},
+ {'name': 'PodToleratesNodeTaints'},
+ {'name': 'CheckNodeMemoryPressure'},
+ {'name': 'CheckNodeDiskPressure'},
+ {'name': 'MatchInterPodAffinity'}
+ ])
+
+ if short_version in ['1.5', '1.6']:
+ predicates.extend([
+ {'name': 'NoVolumeZoneConflict'},
+ {'name': 'MaxEBSVolumeCount'},
+ {'name': 'MaxGCEPDVolumeCount'},
+ {'name': 'MatchInterPodAffinity'},
+ {'name': 'NoDiskConflict'},
+ {'name': 'GeneralPredicates'},
+ {'name': 'PodToleratesNodeTaints'},
+ {'name': 'CheckNodeMemoryPressure'},
+ {'name': 'CheckNodeDiskPressure'},
+ ])
if regions_enabled:
region_predicate = {
diff --git a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py
index 36022597f..95ace7923 100644
--- a/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py
+++ b/roles/openshift_master_facts/lookup_plugins/openshift_master_facts_default_priorities.py
@@ -11,11 +11,7 @@ class LookupModule(LookupBase):
def run(self, terms, variables=None, zones_enabled=True, short_version=None,
deployment_type=None, **kwargs):
- priorities = [
- {'name': 'LeastRequestedPriority', 'weight': 1},
- {'name': 'BalancedResourceAllocation', 'weight': 1},
- {'name': 'SelectorSpreadPriority', 'weight': 1}
- ]
+ priorities = []
if short_version is None or deployment_type is None:
if 'openshift' not in variables:
@@ -57,18 +53,51 @@ class LookupModule(LookupBase):
# convert short_version to origin short_version
short_version = re.sub('^3.', '1.', short_version)
- if short_version == '1.4':
- priorities.append({'name': 'NodePreferAvoidPodsPriority', 'weight': 10000})
-
- # only 1.1 didn't include NodeAffinityPriority
- if short_version != '1.1':
- priorities.append({'name': 'NodeAffinityPriority', 'weight': 1})
+ if short_version == '1.1':
+ priorities.extend([
+ {'name': 'LeastRequestedPriority', 'weight': 1},
+ {'name': 'BalancedResourceAllocation', 'weight': 1},
+ {'name': 'SelectorSpreadPriority', 'weight': 1}
+ ])
+
+ if short_version == '1.2':
+ priorities.extend([
+ {'name': 'LeastRequestedPriority', 'weight': 1},
+ {'name': 'BalancedResourceAllocation', 'weight': 1},
+ {'name': 'SelectorSpreadPriority', 'weight': 1},
+ {'name': 'NodeAffinityPriority', 'weight': 1}
+ ])
+
+ if short_version == '1.3':
+ priorities.extend([
+ {'name': 'LeastRequestedPriority', 'weight': 1},
+ {'name': 'BalancedResourceAllocation', 'weight': 1},
+ {'name': 'SelectorSpreadPriority', 'weight': 1},
+ {'name': 'NodeAffinityPriority', 'weight': 1},
+ {'name': 'TaintTolerationPriority', 'weight': 1}
+ ])
- if short_version not in ['1.1', '1.2']:
- priorities.append({'name': 'TaintTolerationPriority', 'weight': 1})
-
- if short_version not in ['1.1', '1.2', '1.3']:
- priorities.append({'name': 'InterPodAffinityPriority', 'weight': 1})
+ if short_version == '1.4':
+ priorities.extend([
+ {'name': 'LeastRequestedPriority', 'weight': 1},
+ {'name': 'BalancedResourceAllocation', 'weight': 1},
+ {'name': 'SelectorSpreadPriority', 'weight': 1},
+ {'name': 'NodePreferAvoidPodsPriority', 'weight': 10000},
+ {'name': 'NodeAffinityPriority', 'weight': 1},
+ {'name': 'TaintTolerationPriority', 'weight': 1},
+ {'name': 'InterPodAffinityPriority', 'weight': 1}
+ ])
+
+ if short_version in ['1.5', '1.6']:
+ priorities.extend([
+ {'name': 'SelectorSpreadPriority', 'weight': 1},
+ {'name': 'InterPodAffinityPriority', 'weight': 1},
+ {'name': 'LeastRequestedPriority', 'weight': 1},
+ {'name': 'BalancedResourceAllocation', 'weight': 1},
+ {'name': 'NodePreferAvoidPodsPriority', 'weight': 10000},
+ {'name': 'NodeAffinityPriority', 'weight': 1},
+ {'name': 'TaintTolerationPriority', 'weight': 1}
+ ])
if zones_enabled:
zone_priority = {
diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py
index 07bac6826..68b6deb88 100644
--- a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py
+++ b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py
@@ -9,6 +9,9 @@ sys.path = [os.path.abspath(os.path.dirname(__file__) + "/../lookup_plugins/")]
from openshift_master_facts_default_predicates import LookupModule # noqa: E402
+# Predicates ordered according to OpenShift Origin source:
+# origin/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider/defaults/defaults.go
+
DEFAULT_PREDICATES_1_1 = [
{'name': 'PodFitsHostPorts'},
{'name': 'PodFitsResources'},
@@ -48,6 +51,18 @@ DEFAULT_PREDICATES_1_4 = [
{'name': 'MatchInterPodAffinity'}
]
+DEFAULT_PREDICATES_1_5 = [
+ {'name': 'NoVolumeZoneConflict'},
+ {'name': 'MaxEBSVolumeCount'},
+ {'name': 'MaxGCEPDVolumeCount'},
+ {'name': 'MatchInterPodAffinity'},
+ {'name': 'NoDiskConflict'},
+ {'name': 'GeneralPredicates'},
+ {'name': 'PodToleratesNodeTaints'},
+ {'name': 'CheckNodeMemoryPressure'},
+ {'name': 'CheckNodeDiskPressure'},
+]
+
REGION_PREDICATE = {
'name': 'Region',
'argument': {
@@ -66,10 +81,10 @@ TEST_VARS = [
('3.3', 'openshift-enterprise', DEFAULT_PREDICATES_1_3),
('1.4', 'origin', DEFAULT_PREDICATES_1_4),
('3.4', 'openshift-enterprise', DEFAULT_PREDICATES_1_4),
- ('1.5', 'origin', DEFAULT_PREDICATES_1_4),
- ('3.5', 'openshift-enterprise', DEFAULT_PREDICATES_1_4),
- ('1.6', 'origin', DEFAULT_PREDICATES_1_4),
- ('3.6', 'openshift-enterprise', DEFAULT_PREDICATES_1_4),
+ ('1.5', 'origin', DEFAULT_PREDICATES_1_5),
+ ('3.5', 'openshift-enterprise', DEFAULT_PREDICATES_1_5),
+ ('1.6', 'origin', DEFAULT_PREDICATES_1_5),
+ ('3.6', 'openshift-enterprise', DEFAULT_PREDICATES_1_5),
]
diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py
index 5427a07a1..4e44a2b3d 100644
--- a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py
+++ b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py
@@ -40,6 +40,16 @@ DEFAULT_PRIORITIES_1_4 = [
{'name': 'InterPodAffinityPriority', 'weight': 1}
]
+DEFAULT_PRIORITIES_1_5 = [
+ {'name': 'SelectorSpreadPriority', 'weight': 1},
+ {'name': 'InterPodAffinityPriority', 'weight': 1},
+ {'name': 'LeastRequestedPriority', 'weight': 1},
+ {'name': 'BalancedResourceAllocation', 'weight': 1},
+ {'name': 'NodePreferAvoidPodsPriority', 'weight': 10000},
+ {'name': 'NodeAffinityPriority', 'weight': 1},
+ {'name': 'TaintTolerationPriority', 'weight': 1}
+]
+
ZONE_PRIORITY = {
'name': 'Zone',
'argument': {
@@ -58,7 +68,11 @@ TEST_VARS = [
('1.3', 'origin', DEFAULT_PRIORITIES_1_3),
('3.3', 'openshift-enterprise', DEFAULT_PRIORITIES_1_3),
('1.4', 'origin', DEFAULT_PRIORITIES_1_4),
- ('3.4', 'openshift-enterprise', DEFAULT_PRIORITIES_1_4)
+ ('3.4', 'openshift-enterprise', DEFAULT_PRIORITIES_1_4),
+ ('1.5', 'origin', DEFAULT_PRIORITIES_1_5),
+ ('3.5', 'openshift-enterprise', DEFAULT_PRIORITIES_1_5),
+ ('1.6', 'origin', DEFAULT_PRIORITIES_1_5),
+ ('3.6', 'openshift-enterprise', DEFAULT_PRIORITIES_1_5),
]