示例#1
0
 def register(self):
     GlobalVar.register_property(name="deploymentsWithAntiaffinityBalanced",
                                 type=bool,
                                 default=False)
     GlobalVar.register_property(name="add_node_enabled",
                                 type=bool,
                                 default=False)
示例#2
0
 def mark_antiaffinity_met_because_all_antiaffinity_pods_are_matched_and_those_that_cant_dont_suite(
         self, pod: Pod, globalVar: GlobalVar):
     assert pod.calc_antiaffinity_pods_list_length == pod.target_number_of_antiaffinity_pods
     assert pod.antiaffinity_set == True
     # assert globalVar.block_policy_calculated == True
     pod.antiaffinity_met = True
     globalVar.block_policy_calculated = True
示例#3
0
 def mark_affinity_met_because_all_affinity_pods_are_matched(
         self, pod: Pod, globalVar: GlobalVar):
     assert pod.calc_affinity_pods_list_length == pod.podsMatchedByAffinity_length
     assert pod.affinity_set == True
     # assert globalVar.block_policy_calculated == True
     pod.affinity_met = True
     globalVar.block_policy_calculated = True
示例#4
0
 def mark_that_node_cant_allocate_pod_by_mem(self, pod: Pod, node: Node,
                                             globalVar: GlobalVar):
     assert node.isNull == False
     if not node in pod.nodesThatCantAllocateThisPod:
         assert pod.memRequest > node.memCapacity - node.currentFormalMemConsumption
         pod.nodesThatCantAllocateThisPod.add(node)
         pod.nodesThatCantAllocateThisPod_length += 1
     # assert globalVar.block_policy_calculated == True
     globalVar.block_policy_calculated = True
示例#5
0
 def mark_checked_pod_as_affinity_checked_for_target_pod(
         self, target_pod: Pod, checked_pod: Pod, globalVar: GlobalVar,
         scheduler: Scheduler):
     if checked_pod.atNode == target_pod.atNode and \
                 target_pod.affinity_set == True and \
             checked_pod not in target_pod.calc_affinity_pods_list:
         target_pod.calc_affinity_pods_list.add(checked_pod)
         target_pod.calc_affinity_pods_list_length += 1
     assert checked_pod in target_pod.podsMatchedByAffinity
     # assert globalVar.block_policy_calculated == True
     globalVar.block_policy_calculated = True
示例#6
0
 def mark_checked_pod_as_antiaffinity_checked_for_target_pod(
         self, target_pod: Pod, antiaffinity_pod: Pod, globalVar: GlobalVar,
         scheduler: Scheduler, antiaffinity_pod_node: Node):
     if antiaffinity_pod.atNode != target_pod.atNode and \
                 target_pod.antiaffinity_set == True and \
             antiaffinity_pod not in target_pod.calc_antiaffinity_pods_list:
         target_pod.calc_antiaffinity_pods_list.add(antiaffinity_pod)
         target_pod.calc_antiaffinity_pods_list_length += 1
     assert antiaffinity_pod in target_pod.podsMatchedByAntiaffinity
     assert antiaffinity_pod.atNode == antiaffinity_pod_node
     assert antiaffinity_pod_node.isNull == False
     # assert globalVar.block_policy_calculated == True
     globalVar.block_policy_calculated = True
示例#7
0
 def _reset(self):
     "Reset object states and require a rebuild with _bulid_state"
     self.scheduler = Scheduler("Sheduler")
     self.globalvar = GlobalVar("GlobalVar")
     self.state_objects = [self.scheduler, self.globalvar]
示例#8
0
 def BrakeNodeOutageGoal(self, globalVar: GlobalVar, node: Node,
                         node_amountOfActivePods: int):
     assert node.amountOfActivePods == 0
     assert node.isNull == False
     globalVar.is_node_disrupted = True
示例#9
0
 def mark_finalization_of_antiaffinity_setting_for_pods_of_deployment(
         self, deployment: Deployment, globalVar: GlobalVar):
     assert globalVar.amountOfDeploymentsWithAntiaffinity == globalVar.target_amountOfDeploymentsWithAntiaffinity
     globalVar.deploymentsWithAntiaffinityBalanced = True
示例#10
0
 def do_nothing(self,
         service: Service,
         globalVar: GlobalVar):
     assert globalVar.stub == False
     globalVar.stub = True
示例#11
0
 def register(self):
     GlobalVar.register_property(name="stub", type=bool, default=False)