From 459d28e996e4d768fdb81df8948ebef0ce1b03a7 Mon Sep 17 00:00:00 2001 From: Jennifer Chen <32009013+jennchenn@users.noreply.github.com> Date: Thu, 19 Dec 2024 12:08:34 -0500 Subject: [PATCH] [datadogpodautoscalers] Add stabilization window to scaling policy (#1519) * Add stabilization window to scaling policy autoscaling CRD * fixup! Add stabilization window to scaling policy autoscaling CRD * Reorder fields alphabetically * Add validation for stabilization window * Generate DPA CRD files * fixup! Generate DPA CRD files * Remove default setting of stabilization window seconds to 0 * Update minimum stabilization window seconds to 0 * fixup! Update minimum stabilization window seconds to 0 --------- Co-authored-by: levan-m <116471169+levan-m@users.noreply.github.com> --- .../v1alpha1/datadogpodautoscaler_types.go | 7 +++++++ .../v1/datadoghq.com_datadogpodautoscalers.yaml | 16 ++++++++++++++++ .../datadoghq.com_datadogpodautoscalers.yaml | 10 ++++++++++ 3 files changed, 33 insertions(+) diff --git a/api/datadoghq/v1alpha1/datadogpodautoscaler_types.go b/api/datadoghq/v1alpha1/datadogpodautoscaler_types.go index 4500d4eed..b442ccd7c 100644 --- a/api/datadoghq/v1alpha1/datadogpodautoscaler_types.go +++ b/api/datadoghq/v1alpha1/datadogpodautoscaler_types.go @@ -191,6 +191,13 @@ type DatadogPodAutoscalerScalingPolicy struct { // +listType=atomic // +optional Rules []DatadogPodAutoscalerScalingRule `json:"rules,omitempty"` + + // StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations + // before deciding to apply a new one. Defaults to 0. + // +optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=1800 + StabilizationWindowSeconds int32 `json:"stabilizationWindowSeconds,omitempty"` } // DatadogPodAutoscalerScalingRuleType defines how scaling rule value should be interpreted. diff --git a/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml b/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml index 148d84206..5a30875db 100644 --- a/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml +++ b/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml @@ -225,6 +225,14 @@ spec: type: object type: array x-kubernetes-list-type: atomic + stabilizationWindowSeconds: + description: |- + StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations + before deciding to apply a new one. Defaults to 0. + format: int32 + maximum: 1800 + minimum: 0 + type: integer strategy: description: |- Strategy is used to specify which policy should be used. @@ -291,6 +299,14 @@ spec: type: object type: array x-kubernetes-list-type: atomic + stabilizationWindowSeconds: + description: |- + StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations + before deciding to apply a new one. Defaults to 0. + format: int32 + maximum: 1800 + minimum: 0 + type: integer strategy: description: |- Strategy is used to specify which policy should be used. diff --git a/config/crd/bases/v1beta1/datadoghq.com_datadogpodautoscalers.yaml b/config/crd/bases/v1beta1/datadoghq.com_datadogpodautoscalers.yaml index 377924183..2eca96e63 100644 --- a/config/crd/bases/v1beta1/datadoghq.com_datadogpodautoscalers.yaml +++ b/config/crd/bases/v1beta1/datadoghq.com_datadogpodautoscalers.yaml @@ -200,6 +200,11 @@ spec: type: object type: array x-kubernetes-list-type: atomic + stabilizationWindowSeconds: + description: StabilizationWindowSeconds is used to specify the number of seconds to lookback to stabilize new recommendations before deciding to apply a new one. Defaults to 0. + format: int32 + minimum: 0 + type: integer strategy: description: Strategy is used to specify which policy should be used. If not set, the default value Max is used. enum: @@ -256,6 +261,11 @@ spec: type: object type: array x-kubernetes-list-type: atomic + stabilizationWindowSeconds: + description: StabilizationWindowSeconds is used to specify the number of seconds to lookback to stabilize new recommendations. Defaults to 0. + format: int32 + minimum: 0 + type: integer strategy: description: Strategy is used to specify which policy should be used. If not set, the default value Max is used. enum: