generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
618 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,105 @@ | ||
/* | ||
Copyright The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
kueuebeta "sigs.k8s.io/kueue/apis/kueue/v1beta1" | ||
) | ||
|
||
// CohortSpec defines the desired state of Cohort | ||
type CohortSpec struct { | ||
// Parent references the name of the Cohort's parent, if | ||
// any. It satisfies one of three cases: | ||
// 1) Unset. This Cohort is the root of its Cohort tree. | ||
// 2) References a non-existent Cohort. We use default Cohort (no borrowing/lending limits). | ||
// 3) References an existent Cohort. | ||
// | ||
// If a cycle is created, we disable all members of the | ||
// Cohort, including ClusterQueues, until the cycle is | ||
// removed. We prevent further admission while the cycle | ||
// exists. | ||
// | ||
//+kubebuilder:validation:MaxLength=253 | ||
//+kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" | ||
// | ||
Parent string `json:"parent,omitempty"` | ||
|
||
// ResourceGroups describes groupings of Resources and | ||
// Flavors. Each ResourceGroup defines a list of Resources | ||
// and a list of Flavors which provide quotas for these | ||
// Resources. Each Resource and each Flavor may only form part | ||
// of one ResourceGroup. There may be up to 16 ResourceGroups | ||
// within a Cohort. | ||
// | ||
// BorrowingLimit limits how much members of this Cohort | ||
// subtree can borrow from the parent subtree. | ||
// | ||
// LendingLimit limits how much members of this Cohort subtree | ||
// can lend to the parent subtree. | ||
// | ||
// Borrowing and Lending limits must only be set when the | ||
// Cohort has a parent. Otherwise, the Cohort create/update | ||
// will be rejected by the webhook. | ||
// | ||
//+listType=atomic | ||
//+kubebuilder:validation:MaxItems=16 | ||
ResourceGroups []kueuebeta.ResourceGroup `json:"resourceGroups,omitempty"` | ||
} | ||
|
||
const ( | ||
// Condition indicating that a Cohort is correctly configured, | ||
// for example, there is no cycle. | ||
CohortActive = "Active" | ||
) | ||
|
||
// CohortStatus defines the observed state of Cohort | ||
type CohortStatus struct { | ||
|
||
//+listType=map | ||
//+listMapKey=type | ||
//+patchStrategy=merge | ||
//+patchMergeKey=type | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
//+kubebuilder:resource:scope=Cluster | ||
|
||
// Cohort is the Schema for the cohorts API | ||
type Cohort struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec CohortSpec `json:"spec,omitempty"` | ||
Status CohortStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// CohortList contains a list of Cohort | ||
type CohortList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Cohort `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Cohort{}, &CohortList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.