-
Notifications
You must be signed in to change notification settings - Fork 79
feat(kueue): Add Kueue resource wrappers with RHOAI 2.25/3.5 compatibility #2782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jstourac
wants to merge
1
commit into
RedHatQE:main
Choose a base branch
from
jstourac:kueue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| # Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md | ||
|
|
||
|
|
||
| from typing import Any | ||
|
|
||
| from ocp_resources.resource import Resource | ||
|
|
||
|
|
||
| class ClusterQueue(Resource): | ||
| """ | ||
| ClusterQueue is the Schema for the clusterQueue API. | ||
| """ | ||
|
|
||
| api_group: str = Resource.ApiGroup.KUEUE_X_K8S_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| admission_checks: list[Any] | None = None, | ||
| admission_checks_strategy: dict[str, Any] | None = None, | ||
| admission_scope: dict[str, Any] | None = None, | ||
| cohort: str | None = None, | ||
| cohort_name: str | None = None, | ||
| fair_sharing: dict[str, Any] | None = None, | ||
| flavor_fungibility: dict[str, Any] | None = None, | ||
| namespace_selector: dict[str, Any] | None = None, | ||
| preemption: dict[str, Any] | None = None, | ||
| queueing_strategy: str | None = None, | ||
| resource_groups: list[Any] | None = None, | ||
| stop_policy: str | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| admission_checks (list[Any]): admissionChecks lists the AdmissionChecks required by this | ||
| ClusterQueue. Cannot be used along with AdmissionCheckStrategy. | ||
| Available in kueue.x-k8s.io/v1beta1. | ||
|
|
||
| admission_checks_strategy (dict[str, Any]): admissionCheckStrategy defines a list of strategies to determine which | ||
| ResourceFlavors require AdmissionChecks. | ||
|
|
||
| admission_scope (dict[str, Any]): admissionScope indicates whether the ClusterQueue participates in | ||
| AdmissionFairSharing. Available in kueue.x-k8s.io/v1beta2+. | ||
|
|
||
| cohort (str): cohort that this ClusterQueue belongs to. CQs that belong to the same | ||
| cohort can borrow unused resources from each other. | ||
| Available in kueue.x-k8s.io/v1beta1. | ||
|
|
||
| cohort_name (str): cohortName that this ClusterQueue belongs to. CQs that belong to the | ||
| same cohort can borrow unused resources from each other. A CQ can | ||
| be a member of a single borrowing cohort. A workload submitted to | ||
| a queue referencing this CQ can borrow quota from any CQ in the | ||
| cohort. Only quota for the [resource, flavor] pairs listed in the | ||
| CQ can be borrowed. If empty, this ClusterQueue cannot borrow from | ||
| any other ClusterQueue and vice versa. A cohort is a name that | ||
| links CQs together, but it doesn't reference any object. | ||
| Available in kueue.x-k8s.io/v1beta2+. | ||
|
|
||
| fair_sharing (dict[str, Any]): fairSharing defines the properties of the ClusterQueue when | ||
| participating in FairSharing. The values are only relevant if | ||
| FairSharing is enabled in the Kueue configuration. | ||
|
|
||
| flavor_fungibility (dict[str, Any]): flavorFungibility defines whether a workload should try the next | ||
| flavor before borrowing or preempting in the flavor being | ||
| evaluated. | ||
|
|
||
| namespace_selector (dict[str, Any]): namespaceSelector defines which namespaces are allowed to submit | ||
| workloads to this clusterQueue. Beyond this basic support for | ||
| policy, a policy agent like Gatekeeper should be used to enforce | ||
| more advanced policies. Defaults to null which is a nothing | ||
| selector (no namespaces eligible). If set to an empty selector | ||
| `{}`, then all namespaces are eligible. | ||
|
|
||
| preemption (dict[str, Any]): preemption defines the preemption policies for the ClusterQueue. | ||
|
|
||
| queueing_strategy (str): QueueingStrategy indicates the queueing strategy of the workloads | ||
| across the queues in this ClusterQueue. Current Supported | ||
| Strategies: - StrictFIFO: workloads are ordered strictly by | ||
| creation time. Older workloads that can't be admitted will block | ||
| admitting newer workloads even if they fit available quota. - | ||
| BestEffortFIFO: workloads are ordered by creation time, however | ||
| older workloads that can't be admitted will not block admitting | ||
| newer workloads that fit existing quota. | ||
|
|
||
| resource_groups (list[Any]): resourceGroups describes groups of resources. Each resource group | ||
| defines the list of resources and a list of flavors that provide | ||
| quotas for these resources. Each resource and each flavor can only | ||
| form part of one resource group. resourceGroups can be up to 16. | ||
|
|
||
| stop_policy (str): stopPolicy - if set to a value different from None, the ClusterQueue | ||
| is considered Inactive, no new reservation being made. Depending | ||
| on its value, its associated workloads will: - None - Workloads | ||
| are admitted - HoldAndDrain - Admitted workloads are evicted and | ||
| Reserving workloads will cancel the reservation. - Hold - Admitted | ||
| workloads will run to completion and Reserving workloads will | ||
| cancel the reservation. | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.admission_checks = admission_checks | ||
| self.admission_checks_strategy = admission_checks_strategy | ||
| self.admission_scope = admission_scope | ||
| self.cohort = cohort | ||
| self.cohort_name = cohort_name | ||
| self.fair_sharing = fair_sharing | ||
| self.flavor_fungibility = flavor_fungibility | ||
| self.namespace_selector = namespace_selector | ||
| self.preemption = preemption | ||
| self.queueing_strategy = queueing_strategy | ||
| self.resource_groups = resource_groups | ||
| self.stop_policy = stop_policy | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| if self.admission_checks is not None: | ||
| _spec["admissionChecks"] = self.admission_checks | ||
|
|
||
| if self.admission_checks_strategy is not None: | ||
| _spec["admissionChecksStrategy"] = self.admission_checks_strategy | ||
|
|
||
| if self.admission_scope is not None: | ||
| _spec["admissionScope"] = self.admission_scope | ||
|
|
||
| if self.cohort is not None: | ||
| _spec["cohort"] = self.cohort | ||
|
|
||
| if self.cohort_name is not None: | ||
| _spec["cohortName"] = self.cohort_name | ||
|
|
||
| if self.fair_sharing is not None: | ||
| _spec["fairSharing"] = self.fair_sharing | ||
|
|
||
| if self.flavor_fungibility is not None: | ||
| _spec["flavorFungibility"] = self.flavor_fungibility | ||
|
|
||
| if self.namespace_selector is not None: | ||
| _spec["namespaceSelector"] = self.namespace_selector | ||
|
|
||
| if self.preemption is not None: | ||
| _spec["preemption"] = self.preemption | ||
|
|
||
| if self.queueing_strategy is not None: | ||
| _spec["queueingStrategy"] = self.queueing_strategy | ||
|
|
||
| if self.resource_groups is not None: | ||
| _spec["resourceGroups"] = self.resource_groups | ||
|
|
||
| if self.stop_policy is not None: | ||
| _spec["stopPolicy"] = self.stop_policy | ||
|
|
||
| # End of generated code | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md | ||
|
|
||
|
|
||
| from typing import Any | ||
|
|
||
| from ocp_resources.resource import Resource | ||
|
|
||
|
|
||
| class Kueue(Resource): | ||
| """ | ||
| Kueue is the Schema for the kueues API | ||
| """ | ||
|
|
||
| api_group: str = Resource.ApiGroup.COMPONENTS_PLATFORM_OPENDATAHUB_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| auto_create_queues: bool | None = None, | ||
| default_cluster_queue_name: str | None = None, | ||
| default_local_queue_name: str | None = None, | ||
| dev_flags: dict[str, Any] | None = None, | ||
| management_state: str | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| auto_create_queues (bool): Controls whether the operator automatically creates default | ||
| ClusterQueue, LocalQueue and ResourceFlavor resources in managed | ||
| namespaces. When false (the default), the operator skips queue | ||
| creation entirely. Only used when autoCreateQueues is true. | ||
| Available in RHOAI >= 3.5. | ||
|
|
||
| default_cluster_queue_name (str): Configures the automatically created cluster queue name. | ||
|
|
||
| default_local_queue_name (str): Configures the automatically created, in the managed namespaces, local | ||
| queue name. | ||
|
|
||
| dev_flags (dict[str, Any]): Add developer fields. Available in RHOAI <= 2.x. | ||
|
|
||
| management_state (str): Set to one of the following values: - "Managed" : the operator is | ||
| actively managing the component and trying to keep it active. | ||
| It will only upgrade the component if it is safe to do so - | ||
| "Unmanaged" : the operator is actively managing the component and | ||
| trying to keep it active. It will only upgrade the | ||
| component if it is safe to do so - "Removed" : the operator is | ||
| actively managing the component and will not install it, | ||
| or if it is installed, the operator will try to remove it | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.auto_create_queues = auto_create_queues | ||
| self.default_cluster_queue_name = default_cluster_queue_name | ||
| self.default_local_queue_name = default_local_queue_name | ||
| self.dev_flags = dev_flags | ||
| self.management_state = management_state | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| if self.auto_create_queues is not None: | ||
| _spec["autoCreateQueues"] = self.auto_create_queues | ||
|
|
||
| if self.default_cluster_queue_name is not None: | ||
| _spec["defaultClusterQueueName"] = self.default_cluster_queue_name | ||
|
|
||
| if self.default_local_queue_name is not None: | ||
| _spec["defaultLocalQueueName"] = self.default_local_queue_name | ||
|
|
||
| if self.dev_flags is not None: | ||
| _spec["devFlags"] = self.dev_flags | ||
|
|
||
| if self.management_state is not None: | ||
| _spec["managementState"] = self.management_state | ||
|
|
||
| # End of generated code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md | ||
|
|
||
|
|
||
| from typing import Any | ||
|
|
||
| from ocp_resources.resource import Resource | ||
|
|
||
|
|
||
| class Kueue(Resource): | ||
| """ | ||
| Kueue is the CRD to represent the Kueue operator. | ||
| """ | ||
|
|
||
| api_group: str = Resource.ApiGroup.KUEUE_OPENSHIFT_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| config: dict[str, Any] | None = None, | ||
| log_level: str | None = None, | ||
| management_state: str | None = None, | ||
| observed_config: dict[str, Any] | None = None, | ||
| operator_log_level: str | None = None, | ||
| unsupported_config_overrides: dict[str, Any] | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| config (dict[str, Any]): config is the desired configuration for the Kueue operator. | ||
|
|
||
| log_level (str): logLevel is an intent based logging for an overall component. It does | ||
| not give fine grained control, but it is a simple way to manage | ||
| coarse grained logging choices that operators have to interpret | ||
| for their operands. Valid values are: "Normal", "Debug", "Trace", | ||
| "TraceAll". Defaults to "Normal". | ||
|
|
||
| management_state (str): managementState indicates whether and how the operator should manage | ||
| the component | ||
|
|
||
| observed_config (dict[str, Any]): observedConfig holds a sparse config that controller has observed from | ||
| the cluster state. It exists in spec because it is an input to | ||
| the level for the operator | ||
|
|
||
| operator_log_level (str): operatorLogLevel is an intent based logging for the operator itself. | ||
| It does not give fine grained control, but it is a simple way to | ||
| manage coarse grained logging choices that operators have to | ||
| interpret for themselves. Valid values are: "Normal", "Debug", | ||
| "Trace", "TraceAll". Defaults to "Normal". | ||
|
|
||
| unsupported_config_overrides (dict[str, Any]): unsupportedConfigOverrides overrides the final configuration that was | ||
| computed by the operator. Red Hat does not support the use of this | ||
| field. Misuse of this field could lead to unexpected behavior or | ||
| conflict with other configuration options. Seek guidance from the | ||
| Red Hat support before using this field. Use of this property | ||
| blocks cluster upgrades, it must be removed before upgrading your | ||
| cluster. | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.config = config | ||
| self.log_level = log_level | ||
| self.management_state = management_state | ||
| self.observed_config = observed_config | ||
| self.operator_log_level = operator_log_level | ||
| self.unsupported_config_overrides = unsupported_config_overrides | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| if self.config is not None: | ||
| _spec["config"] = self.config | ||
|
|
||
| if self.log_level is not None: | ||
| _spec["logLevel"] = self.log_level | ||
|
|
||
| if self.management_state is not None: | ||
| _spec["managementState"] = self.management_state | ||
|
|
||
| if self.observed_config is not None: | ||
| _spec["observedConfig"] = self.observed_config | ||
|
|
||
| if self.operator_log_level is not None: | ||
| _spec["operatorLogLevel"] = self.operator_log_level | ||
|
|
||
| if self.unsupported_config_overrides is not None: | ||
| _spec["unsupportedConfigOverrides"] = self.unsupported_config_overrides | ||
|
|
||
| # End of generated code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md | ||
|
|
||
|
|
||
| from typing import Any | ||
|
|
||
| from ocp_resources.resource import NamespacedResource | ||
|
|
||
|
|
||
| class LocalQueue(NamespacedResource): | ||
| """ | ||
| LocalQueue is the Schema for the localQueues API | ||
| """ | ||
|
|
||
| api_group: str = NamespacedResource.ApiGroup.KUEUE_X_K8S_IO | ||
|
|
||
| def __init__( | ||
| self, | ||
| cluster_queue: str | None = None, | ||
| fair_sharing: dict[str, Any] | None = None, | ||
| stop_policy: str | None = None, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| r""" | ||
| Args: | ||
| cluster_queue (str): clusterQueue is a reference to a clusterQueue that backs this | ||
| localQueue. | ||
|
|
||
| fair_sharing (dict[str, Any]): fairSharing defines the properties of the LocalQueue when | ||
| participating in AdmissionFairSharing. The values are only | ||
| relevant if AdmissionFairSharing is enabled in the Kueue | ||
| configuration. Available in kueue.x-k8s.io/v1beta2+. | ||
|
|
||
| stop_policy (str): stopPolicy - if set to a value different from None, the LocalQueue is | ||
| considered Inactive, no new reservation being made. Depending on | ||
| its value, its associated workloads will: - None - Workloads are | ||
| admitted - HoldAndDrain - Admitted workloads are evicted and | ||
| Reserving workloads will cancel the reservation. - Hold - Admitted | ||
| workloads will run to completion and Reserving workloads will | ||
| cancel the reservation. | ||
|
|
||
| """ | ||
| super().__init__(**kwargs) | ||
|
|
||
| self.cluster_queue = cluster_queue | ||
| self.fair_sharing = fair_sharing | ||
| self.stop_policy = stop_policy | ||
|
|
||
| def to_dict(self) -> None: | ||
|
|
||
| super().to_dict() | ||
|
|
||
| if not self.kind_dict and not self.yaml_file: | ||
| self.res["spec"] = {} | ||
| _spec = self.res["spec"] | ||
|
|
||
| if self.cluster_queue is not None: | ||
| _spec["clusterQueue"] = self.cluster_queue | ||
|
|
||
| if self.fair_sharing is not None: | ||
| _spec["fairSharing"] = self.fair_sharing | ||
|
|
||
| if self.stop_policy is not None: | ||
| _spec["stopPolicy"] = self.stop_policy | ||
|
|
||
| # End of generated code |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. Invalid clusterqueue spec combo
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be addressed already