Coverage for ocp_resources/scheduler.py: 0%
23 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
3from typing import Any, Dict, Optional
4from ocp_resources.resource import Resource
7class Scheduler(Resource):
8 """
9 Scheduler holds cluster-wide config information to run the Kubernetes Scheduler and influence its placement decisions. The canonical name for this config is `cluster`.
10 Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
11 """
13 api_group: str = Resource.ApiGroup.CONFIG_OPENSHIFT_IO
15 def __init__(
16 self,
17 default_node_selector: Optional[str] = "",
18 masters_schedulable: Optional[bool] = None,
19 policy: Optional[Dict[str, Any]] = None,
20 profile: Optional[str] = "",
21 **kwargs: Any,
22 ) -> None:
23 """
24 Args:
25 default_node_selector (str): defaultNodeSelector helps set the cluster-wide default node selector
26 to restrict pod placement to specific nodes. This is applied to
27 the pods created in all namespaces and creates an intersection
28 with any existing nodeSelectors already set on a pod, additionally
29 constraining that pod's selector. For example,
30 defaultNodeSelector: "type=user-node,region=east" would set
31 nodeSelector field in pod spec to "type=user-node,region=east" to
32 all pods created in all namespaces. Namespaces having project-wide
33 node selectors won't be impacted even if this field is set. This
34 adds an annotation section to the namespace. For example, if a new
35 namespace is created with node-selector='type=user-
36 node,region=east', the annotation openshift.io/node-selector:
37 type=user-node,region=east gets added to the project. When the
38 openshift.io/node-selector annotation is set on the project the
39 value is used in preference to the value we are setting for
40 defaultNodeSelector field. For instance, openshift.io/node-
41 selector: "type=user-node,region=west" means that the default of
42 "type=user-node,region=east" set in defaultNodeSelector would not
43 be applied.
45 masters_schedulable (bool): MastersSchedulable allows masters nodes to be schedulable. When this
46 flag is turned on, all the master nodes in the cluster will be
47 made schedulable, so that workload pods can run on them. The
48 default value for this field is false, meaning none of the master
49 nodes are schedulable. Important Note: Once the workload pods
50 start running on the master nodes, extreme care must be taken to
51 ensure that cluster-critical control plane components are not
52 impacted. Please turn on this field after doing due diligence.
54 policy (Dict[str, Any]): DEPRECATED: the scheduler Policy API has been deprecated and will be
55 removed in a future release. policy is a reference to a ConfigMap
56 containing scheduler policy which has user specified predicates
57 and priorities. If this ConfigMap is not available scheduler will
58 default to use DefaultAlgorithmProvider. The namespace for this
59 configmap is openshift-config.
61 profile (str): profile sets which scheduling profile should be set in order to
62 configure scheduling decisions for new pods. Valid values are
63 "LowNodeUtilization", "HighNodeUtilization", "NoScoring" Defaults
64 to "LowNodeUtilization"
66 """
67 super().__init__(**kwargs)
69 self.default_node_selector = default_node_selector
70 self.masters_schedulable = masters_schedulable
71 self.policy = policy
72 self.profile = profile
74 def to_dict(self) -> None:
75 super().to_dict()
77 if not self.kind_dict and not self.yaml_file:
78 self.res["spec"] = {}
79 _spec = self.res["spec"]
81 if self.default_node_selector:
82 _spec["defaultNodeSelector"] = self.default_node_selector
84 if self.masters_schedulable is not None:
85 _spec["mastersSchedulable"] = self.masters_schedulable
87 if self.policy:
88 _spec["policy"] = self.policy
90 if self.profile:
91 _spec["profile"] = self.profile
93 # End of generated code