sigs.k8s.io/kueue@v0.6.2/apis/kueue/v1beta1/provisioningrequestconfig_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  // ProvisioningRequestConfigSpec defines the desired state of ProvisioningRequestConfig
    25  type ProvisioningRequestConfigSpec struct {
    26  	// ProvisioningClassName describes the different modes of provisioning the resources.
    27  	// Check autoscaling.x-k8s.io ProvisioningRequestSpec.ProvisioningClassName for details.
    28  	//
    29  	// +kubebuilder:validation:Required
    30  	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
    31  	// +kubebuilder:validation:MaxLength=253
    32  	ProvisioningClassName string `json:"provisioningClassName"`
    33  
    34  	// Parameters contains all other parameters classes may require.
    35  	//
    36  	// +optional
    37  	// +kubebuilder:validation:MaxProperties=100
    38  	Parameters map[string]Parameter `json:"parameters,omitempty"`
    39  
    40  	// managedResources contains the list of resources managed by the autoscaling.
    41  	//
    42  	// If empty, all resources are considered managed.
    43  	//
    44  	// If not empty, the ProvisioningRequest will contain only the podsets that are
    45  	// requesting at least one of them.
    46  	//
    47  	// If none of the workloads podsets is requesting at least a managed resource,
    48  	// the workload is considered ready.
    49  	//
    50  	// +optional
    51  	// +listType=set
    52  	// +kubebuilder:validation:MaxItems=100
    53  	ManagedResources []corev1.ResourceName `json:"managedResources,omitempty"`
    54  }
    55  
    56  // Parameter is limited to 255 characters.
    57  // +kubebuilder:validation:MaxLength=255
    58  type Parameter string
    59  
    60  // +genclient
    61  // +genclient:nonNamespaced
    62  // +kubebuilder:object:root=true
    63  // +kubebuilder:storageversion
    64  // +kubebuilder:resource:scope=Cluster
    65  
    66  // ProvisioningRequestConfig is the Schema for the provisioningrequestconfig API
    67  type ProvisioningRequestConfig struct {
    68  	metav1.TypeMeta   `json:",inline"`
    69  	metav1.ObjectMeta `json:"metadata,omitempty"`
    70  
    71  	Spec ProvisioningRequestConfigSpec `json:"spec,omitempty"`
    72  }
    73  
    74  // +kubebuilder:object:root=true
    75  
    76  // ProvisioningRequestConfigList contains a list of ProvisioningRequestConfig
    77  type ProvisioningRequestConfigList struct {
    78  	metav1.TypeMeta `json:",inline"`
    79  	metav1.ListMeta `json:"metadata,omitempty"`
    80  	Items           []ProvisioningRequestConfig `json:"items"`
    81  }
    82  
    83  func init() {
    84  	SchemeBuilder.Register(&ProvisioningRequestConfig{}, &ProvisioningRequestConfigList{})
    85  }