sigs.k8s.io/kueue@v0.6.2/apis/kueue/v1beta1/resourceflavor_types.go (about) 1 /* 2 Copyright 2023 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1beta1 18 19 import ( 20 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 ) 23 24 // +genclient 25 // +genclient:nonNamespaced 26 // +kubebuilder:object:root=true 27 // +kubebuilder:storageversion 28 // +kubebuilder:resource:scope=Cluster,shortName={flavor,flavors} 29 30 // ResourceFlavor is the Schema for the resourceflavors API. 31 type ResourceFlavor struct { 32 metav1.TypeMeta `json:",inline"` 33 metav1.ObjectMeta `json:"metadata,omitempty"` 34 35 Spec ResourceFlavorSpec `json:"spec,omitempty"` 36 } 37 38 // ResourceFlavorSpec defines the desired state of the ResourceFlavor 39 type ResourceFlavorSpec struct { 40 // nodeLabels are labels that associate the ResourceFlavor with Nodes that 41 // have the same labels. 42 // When a Workload is admitted, its podsets can only get assigned 43 // ResourceFlavors whose nodeLabels match the nodeSelector and nodeAffinity 44 // fields. 45 // Once a ResourceFlavor is assigned to a podSet, the ResourceFlavor's 46 // nodeLabels should be injected into the pods of the Workload by the 47 // controller that integrates with the Workload object. 48 // 49 // nodeLabels can be up to 8 elements. 50 // +optional 51 // +mapType=atomic 52 // +kubebuilder:validation:MaxProperties=8 53 NodeLabels map[string]string `json:"nodeLabels,omitempty"` 54 55 // nodeTaints are taints that the nodes associated with this ResourceFlavor 56 // have. 57 // Workloads' podsets must have tolerations for these nodeTaints in order to 58 // get assigned this ResourceFlavor during admission. 59 // 60 // An example of a nodeTaint is 61 // cloud.provider.com/preemptible="true":NoSchedule 62 // 63 // nodeTaints can be up to 8 elements. 64 // 65 // +optional 66 // +listType=atomic 67 // +kubebuilder:validation:MaxItems=8 68 NodeTaints []corev1.Taint `json:"nodeTaints,omitempty"` 69 70 // tolerations are extra tolerations that will be added to the pods admitted in 71 // the quota associated with this resource flavor. 72 // 73 // An example of a toleration is 74 // cloud.provider.com/preemptible="true":NoSchedule 75 // 76 // tolerations can be up to 8 elements. 77 // 78 // +optional 79 // +listType=atomic 80 // +kubebuilder:validation:MaxItems=8 81 Tolerations []corev1.Toleration `json:"tolerations,omitempty"` 82 } 83 84 // +kubebuilder:object:root=true 85 86 // ResourceFlavorList contains a list of ResourceFlavor 87 type ResourceFlavorList struct { 88 metav1.TypeMeta `json:",inline"` 89 metav1.ListMeta `json:"metadata,omitempty"` 90 Items []ResourceFlavor `json:"items"` 91 } 92 93 func init() { 94 SchemeBuilder.Register(&ResourceFlavor{}, &ResourceFlavorList{}) 95 }