Skip to content
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

Add support for initialCooldownPeriod On httpScaledObjects #1212

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This changelog keeps track of work items that have been completed and are ready
- **General**: Support portName in HTTPScaledObject service scaleTargetRef ([#1174](https://github.com/kedacore/http-add-on/issues/1174))
- **General**: Support setting multiple TLS certs for different domains on the interceptor proxy ([#1116](https://github.com/kedacore/http-add-on/issues/1116))
- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
- **General**: Support InitialCooldownPeriod for HTTPScaledObject [#1213](https://github.com/kedacore/http-add-on/issues/1213)

- **Interceptor**: Add support for for AWS ELB healthcheck probe ([#1198](https://github.com/kedacore/http-add-on/issues/1198))

Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/http.keda.sh_httpscaledobjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ spec:
items:
type: string
type: array
initialCooldownPeriod:
description: (optional) Initial period before scaling
format: int32
type: integer
pathPrefixes:
description: |-
The paths to route. All requests which the Request Target matches any
Expand Down
3 changes: 3 additions & 0 deletions operator/apis/http/v1alpha1/httpscaledobject_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ type HTTPScaledObjectSpec struct {
// (optional) Cooldown period value
// +optional
CooldownPeriod *int32 `json:"scaledownPeriod,omitempty" description:"Cooldown period (seconds) for resources to scale down (Default 300)"`
// (optional) Initial period before scaling
// +optional
InitialCooldownPeriod *int32 `json:"initialCooldownPeriod,omitempty" description:"Initial period (seconds) before scaling (Default 0)"`
// (optional) Configuration for the metric used for scaling
// +optional
ScalingMetric *ScalingMetricSpec `json:"scalingMetric,omitempty" description:"Configuration for the metric used for scaling. If empty 'concurrency' will be used"`
Expand Down
1 change: 1 addition & 0 deletions operator/controllers/http/scaled_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (r *HTTPScaledObjectReconciler) createOrUpdateScaledObject(
minReplicaCount,
maxReplicaCount,
httpso.Spec.CooldownPeriod,
httpso.Spec.InitialCooldownPeriod,
)

// Set HTTPScaledObject instance as the owner and controller
Expand Down
10 changes: 6 additions & 4 deletions pkg/k8s/scaledobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func NewScaledObject(
minReplicas *int32,
maxReplicas *int32,
cooldownPeriod *int32,
initialCooldownPeriod *int32,
) *kedav1alpha1.ScaledObject {
return &kedav1alpha1.ScaledObject{
TypeMeta: metav1.TypeMeta{
Expand All @@ -45,10 +46,11 @@ func NewScaledObject(
Kind: workloadRef.Kind,
Name: workloadRef.Name,
},
PollingInterval: ptr.To[int32](soPollingInterval),
CooldownPeriod: cooldownPeriod,
MinReplicaCount: minReplicas,
MaxReplicaCount: maxReplicas,
PollingInterval: ptr.To[int32](soPollingInterval),
CooldownPeriod: cooldownPeriod,
InitialCooldownPeriod: initialCooldownPeriod,
MinReplicaCount: minReplicas,
MaxReplicaCount: maxReplicas,
Advanced: &kedav1alpha1.AdvancedConfig{
RestoreToOriginalReplicaCount: true,
},
Expand Down