-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial draft for review before generating code #1015
base: main
Are you sure you want to change the base?
Conversation
@@ -18,6 +18,7 @@ limitations under the License. | |||
package v1beta1 | |||
|
|||
import ( | |||
v2 "k8s.io/api/autoscaling/v2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2 "k8s.io/api/autoscaling/v2" | |
autoscalingv2 "k8s.io/api/autoscaling/v2" |
// This struct allows customization of autoscaling. A custom metric can be used instead of the memory and cpu metrics. | ||
// The scaling behavior can also be customized to meet different performance requirements. The maximum and mininum of | ||
// sizes of the replica sets can be specified to limit the use of resources. | ||
Custom Custom `json:"custom,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be a pointer.
} | ||
|
||
// Custom customizes VerticaAutoscaler | ||
type Custom struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use a better name. Maybe CustomAutoscalerSpec
?
// +kubebuilder:default:=3 | ||
// +kubebuilder:Minimum:=3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:default:=3 | |
// +kubebuilder:Minimum:=3 | |
// +kubebuilder:Minimum:=0 |
// the mininum size of replica set | ||
MinReplicas int32 `json:"minReplicas"` | ||
|
||
// +kubebuilder:validation:Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:validation:Optional | |
// +kubebuilder:Minimum:=0 |
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the mininum size of replica set | ||
MinReplicas int32 `json:"minReplicas"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pointer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an integer. Using a pointer will not reduce memory footprint. Do you really want to use a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will avoid a conversion later as the hpa expects a pointer.
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the custom metric to be used for autocaling | ||
Metrics v2.MetricSpec `json:"metrics"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a list.
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// define how the autocaler handles the scaleup and scaledown | ||
Behavior v2.HorizontalPodAutoscalerBehavior `json:"behavior,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
||
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the value used to increase the threshold after after a scale up or a scale down |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the value used to increase the threshold after after a scale up or a scale down | |
// The value used to increase the threshold after a scale up or a scale down. |
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the maximum size of replica set | ||
MaxReplicas *int32 `json:"maxReplicas"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +operator-sdk:csv:customresourcedefinitions:type=spec | |
// the maximum size of replica set | |
MaxReplicas *int32 `json:"maxReplicas"` | |
// +operator-sdk:csv:customresourcedefinitions:type=spec | |
// The maximum number of pods when scaling. | |
MaxReplicas int32 `json:"maxReplicas"` |
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the value used to increase the threshold after after a scale up or a scale down | ||
Increment *int32 `json:"increment"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increment *int32 `json:"increment"` | |
ThresholdAdjustmentValue int32 `json:"thresholdAdjustmentValue,omitempty"` |
I changed this field's name after your comment, it is always positive
// MetricDefinition defines increment and metric to be used for autoscaling | ||
type MetricDefinition struct { | ||
|
||
// +kubebuilder:validation:Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:validation:Optional | |
// +kubebuilder:validation:Optional | |
// +kubebuilder:Minimum:=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the increment can only be positive, we can only increase threshold and cannot decrease it. That will work for scale up but not scale down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is no longer an increment but a value. For scale up it will be used to decrease.
|
||
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the custom metric to be used for autocaling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the custom metric to be used for autocaling | |
// The custom metric to be used for autocaling. |
|
||
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// define how the autocaler handles the scaleup and scaledown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// define how the autocaler handles the scaleup and scaledown | |
// Specifies the scaling behavior for both scale up and down. |
// +kubebuilder:Minimum:=0 | ||
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the mininum size of replica set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the mininum size of replica set | |
// The miminum number of pods when scaling. |
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the mininum size of replica set | ||
MinReplicas *int32 `json:"minReplicas"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MinReplicas *int32 `json:"minReplicas"` | |
MinReplicas *int32 `json:"minReplicas,omitempty"` |
// +kubebuilder:Minimum:=0 | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the maximum size of replica set | ||
MaxReplicas *int32 `json:"maxReplicas"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MaxReplicas *int32 `json:"maxReplicas"` | |
MaxReplicas *int32 `json:"maxReplicas,omitempty"` |
// the custom metric and increment to be used for autocaling | ||
Metrics []MetricDefinition `json:"metrics"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the custom metric and increment to be used for autocaling | |
Metrics []MetricDefinition `json:"metrics"` | |
// The custom metric to be used for autocaling. | |
Metrics []MetricDefinition `json:"metrics,omitempty"` |
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// the custom metric to be used for autocaling | ||
Metric autoscalingv2.MetricSpec `json:"metric"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metric autoscalingv2.MetricSpec `json:"metric"` | |
Metric autoscalingv2.MetricSpec `json:"metric,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will approve after this last round.
// The miminum number of pods when scaling. | ||
MinReplicas *int32 `json:"minReplicas,omitempty"` | ||
|
||
// +kubebuilder:validation:Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:validation:Optional |
// +kubebuilder:Minimum:=0 | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// The maximum number of pods when scaling. | ||
MaxReplicas *int32 `json:"maxReplicas,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MaxReplicas *int32 `json:"maxReplicas,omitempty"` | |
MaxReplicas int32 `json:"maxReplicas,omitempty"` |
// This struct allows customization of autoscaling. Custom metrics can be used instead of the memory and cpu metrics. | ||
// The scaling behavior can also be customized to meet different performance requirements. The maximum and mininum of | ||
// sizes of the replica sets can be specified to limit the use of resources. | ||
CustomAutoscalerSpec *CustomAutoscalerSpec `json:"customAutoscalerSpec,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CustomAutoscalerSpec *CustomAutoscalerSpec `json:"customAutoscalerSpec,omitempty"` | |
CustomAutoscaler *CustomAutoscalerSpec `json:"customAutoscalerSpec,omitempty"` |
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// +kubebuilder:Minimum:=0 | ||
// The value used to increase the threshold after after a scale up or a scale down. | ||
ThresholdAdjustmentValue *int32 `json:"thresholdAdjustmentValue,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ThresholdAdjustmentValue *int32 `json:"thresholdAdjustmentValue,omitempty"` | |
ThresholdAdjustmentValue int `json:"thresholdAdjustmentValue,omitempty"` |
|
||
// +kubebuilder:validation:Optional | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec | ||
// The custom metric and increment to be used for autocaling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The custom metric and increment to be used for autocaling. | |
// The custom metric definition to be used for autocaling. |
I would like to get some feedback before generating code for new those fields.