kubeblocks icon indicating copy to clipboard operation
kubeblocks copied to clipboard

[Improvement] Increasing the allowed range of Maxreplicas and setting both fields in replicasLimit to optional

Open ian-hui opened this issue 6 months ago • 11 comments

Is your improvement request related to a problem? Please describe.

  1. the allowed range of Maxreplicas values ​​is too small. The maximum replicasLimit in componentdefinition can be set to 128, which doesn't meet my needs.
  2. Setting both fields in replicasLimit to optional which are required in v1.0.0-alpha1 could give users a better experience
image

If this is a new function, please describe the motivation and goals.

(A clear and concise description of why you want to happen, link the design doc if possible)

like the below struct

// ReplicasLimit defines the valid range of number of replicas supported.
//
// +kubebuilder:validation:XValidation:rule="self.minReplicas >= 0 && self.maxReplicas <= 2147483647",message="the minimum and maximum limit of replicas should be in the range of [0, math.MaxInt32]"
// +kubebuilder:validation:XValidation:rule="self.minReplicas <= self.maxReplicas",message="the minimum replicas limit should be no greater than the maximum"
type ReplicasLimit struct {
	// The minimum limit of replicas.
	//
	// +kubebuilder:default=1
	// +optional
	MinReplicas int32 `json:"minReplicas,omitempty"`

	// The maximum limit of replicas.
	//
	// +kubebuilder:default=2147483647
	// +optional
	MaxReplicas int32 `json:"maxReplicas,omitempty"`
}

the fields in ReplicasLimit should not be required. If the user does not fill the maxReplicas or minReplicas, they should be the default value.

ian-hui avatar Aug 07 '24 15:08 ian-hui