github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/api/v1alpha1/spaceprovisionerconfig_types.go (about) 1 package v1alpha1 2 3 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 4 5 const ( 6 SpaceProvisionerConfigToolchainClusterNotFoundReason = "ToolchainClusterNotFound" 7 SpaceProvisionerConfigValidReason = "AllChecksPassed" 8 ) 9 10 // +k8s:openapi-gen=true 11 type SpaceProvisionerConfigSpec struct { 12 // PlacementRoles is the list of roles, or flavors, that the provisioner possesses that influence 13 // the space scheduling decisions. 14 // +optional 15 // +listType=set 16 PlacementRoles []string `json:"placementRoles,omitempty"` 17 18 // ToolchainCluster is the name of the ToolchainCluster CR of the member cluster that this config is for. 19 ToolchainCluster string `json:"toolchainCluster"` 20 21 // Enabled specifies whether the member cluster is enabled (and therefore can hold spaces) or not. 22 // +optional 23 // +kubebuilder:default=false 24 Enabled bool `json:"enabled"` 25 26 // CapacityThresholds specifies the max capacities allowed in this provisioner 27 // +optional 28 CapacityThresholds SpaceProvisionerCapacityThresholds `json:"capacityThresholds"` 29 } 30 31 // SpaceProvisionerCapacityThresholds defines the capacity thresholds of the space provisioner 32 // +k8s:openapi-gen=true 33 type SpaceProvisionerCapacityThresholds struct { 34 // MaxNumberOfSpaces is the maximum number of spaces that can be provisioned to the referenced cluster. 35 // 36 // 0 or undefined value means no limit. 37 // 38 // +kubebuilder:validation:Minimum=0 39 // +optional 40 MaxNumberOfSpaces uint `json:"maxNumberOfSpaces,omitempty"` 41 // MaxMemoryUtilizationPercent is the maximum memory utilization of the cluster to permit provisioning 42 // new spaces to it. 43 // 44 // 0 or undefined value means no limit. 45 // 46 // +kubebuilder:validation:Minimum=0 47 // +kubebuilder:validation:Maximum=100 48 // +optional 49 MaxMemoryUtilizationPercent uint `json:"maxMemoryUtilizationPercent,omitempty"` 50 } 51 52 // +k8s:openapi-gen=true 53 type SpaceProvisionerConfigStatus struct { 54 // Conditions describes the state of the configuration (its validity). 55 // The only known condition type is "Ready". 56 // +optional 57 // +patchMergeKey=type 58 // +patchStrategy=merge 59 // +listType=map 60 // +listMapKey=type 61 Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` 62 } 63 64 // SpaceProvisionerConfig is the configuration of space provisioning in the member clusters. 65 // 66 // +k8s:openapi-gen=true 67 // +kubebuilder:object:root=true 68 // +kubebuilder:subresource:status 69 // +kubebuilder:resource:scope=Namespaced 70 // +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=`.spec.toolchainCluster` 71 // +kubebuilder:printcolumn:name="Enabled",type="boolean",JSONPath=`.spec.enabled` 72 // +kubebuilder:validation:XPreserveUnknownFields 73 // +operator-sdk:gen-csv:customresourcedefinitions.displayName="SpaceProvisionerConfig" 74 type SpaceProvisionerConfig struct { 75 Spec SpaceProvisionerConfigSpec `json:"spec,omitempty"` 76 Status SpaceProvisionerConfigStatus `json:"status,omitempty"` 77 metav1.TypeMeta `json:",inline"` 78 metav1.ObjectMeta `json:"metadata,omitempty"` 79 } 80 81 //+kubebuilder:object:root=true 82 83 // SpaceProvisionerConfigList contains a list of SpaceProvisionerConfig 84 // +k8s:openapi-gen=true 85 type SpaceProvisionerConfigList struct { 86 metav1.TypeMeta `json:",inline"` 87 metav1.ListMeta `json:"metadata,omitempty"` 88 Items []SpaceProvisionerConfig `json:"items"` 89 } 90 91 func init() { 92 SchemeBuilder.Register(&SpaceProvisionerConfig{}, &SpaceProvisionerConfigList{}) 93 }