sigs.k8s.io/kueue@v0.6.2/apis/kueue/v1alpha1/multikueue_types.go (about) 1 /* 2 Copyright 2024 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 v1alpha1 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 ) 22 23 const ( 24 MultiKueueConfigSecretKey = "kubeconfig" 25 MultiKueueClusterActive = "Active" 26 27 // MultiKueueOriginLabel is a label used to track the creator 28 // of multikueue remote objects. 29 MultiKueueOriginLabel = "kueue.x-k8s.io/multikueue-origin" 30 ) 31 32 type LocationType string 33 34 const ( 35 // Location is the path on the disk of kueue-controller-manager. 36 PathLocationType LocationType = "Path" 37 38 // Location is the name of the secret inside the namespace in which the kueue controller 39 // manager is running. The config should be stored in the "kubeconfig" key. 40 SecretLocationType LocationType = "Secret" 41 ) 42 43 type KubeConfig struct { 44 // Location of the KubeConfig. 45 // 46 // If LocationType is Secret then Location is the name of the secret inside the namespace in 47 // which the kueue controller manager is running. The config should be stored in the "kubeconfig" key. 48 Location string `json:"location"` 49 50 // Type of the KubeConfig location. 51 // 52 // +kubebuilder:default=Secret 53 // +kubebuilder:validation:Enum=Secret;Path 54 LocationType LocationType `json:"locationType"` 55 } 56 57 type MultiKueueClusterSpec struct { 58 // Information how to connect to the cluster. 59 KubeConfig KubeConfig `json:"kubeConfig"` 60 } 61 62 type MultiKueueClusterStatus struct { 63 // +optional 64 // +listType=map 65 // +listMapKey=type 66 // +patchStrategy=merge 67 // +patchMergeKey=type 68 Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 69 } 70 71 // +genclient 72 // +genclient:nonNamespaced 73 // +kubebuilder:object:root=true 74 // +kubebuilder:storageversion 75 // +kubebuilder:subresource:status 76 // +kubebuilder:resource:scope=Cluster 77 78 // MultiKueueCluster is the Schema for the multikueue API 79 type MultiKueueCluster struct { 80 metav1.TypeMeta `json:",inline"` 81 metav1.ObjectMeta `json:"metadata,omitempty"` 82 83 Spec MultiKueueClusterSpec `json:"spec,omitempty"` 84 Status MultiKueueClusterStatus `json:"status,omitempty"` 85 } 86 87 // +kubebuilder:object:root=true 88 89 // MultiKueueClusterList contains a list of MultiKueueCluster 90 type MultiKueueClusterList struct { 91 metav1.TypeMeta `json:",inline"` 92 metav1.ListMeta `json:"metadata,omitempty"` 93 Items []MultiKueueCluster `json:"items"` 94 } 95 96 // MultiKueueConfigSpec defines the desired state of MultiKueueConfig 97 type MultiKueueConfigSpec struct { 98 // List of MultiKueueClusters names where the workloads from the ClusterQueue should be distributed. 99 // 100 // +listType=set 101 // +kubebuilder:validation:MinItems=1 102 // +kubebuilder:validation:MaxItems=10 103 Clusters []string `json:"clusters"` 104 } 105 106 // +genclient 107 // +genclient:nonNamespaced 108 // +kubebuilder:object:root=true 109 // +kubebuilder:storageversion 110 // +kubebuilder:resource:scope=Cluster 111 112 // MultiKueueConfig is the Schema for the multikueue API 113 type MultiKueueConfig struct { 114 metav1.TypeMeta `json:",inline"` 115 metav1.ObjectMeta `json:"metadata,omitempty"` 116 117 Spec MultiKueueConfigSpec `json:"spec,omitempty"` 118 } 119 120 // +kubebuilder:object:root=true 121 122 // MultiKueueConfigList contains a list of MultiKueueConfig 123 type MultiKueueConfigList struct { 124 metav1.TypeMeta `json:",inline"` 125 metav1.ListMeta `json:"metadata,omitempty"` 126 Items []MultiKueueConfig `json:"items"` 127 } 128 129 func init() { 130 SchemeBuilder.Register(&MultiKueueConfig{}, &MultiKueueConfigList{}, &MultiKueueCluster{}, &MultiKueueClusterList{}) 131 }