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

Make PollingInterval configurable in HTTPScaledObject #1252

Open
wants to merge 1 commit 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**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
- **General**: Fix kubectl active printcolumn ([#1211](https://github.com/kedacore/http-add-on/issues/1211))
- **General**: Allow configuration of PollingInterval in HTTPScaledObject ([#1251](https://github.com/kedacore/http-add-on/issues/1251))

### Improvements

Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/http.keda.sh_httpscaledobjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ spec:
items:
type: string
type: array
pollingInterval:
description: (optional) Configuration for the polling interval of
the scaling metric
format: int32
type: integer
replicas:
description: (optional) Replica information
properties:
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) Configuration for the polling interval of the scaling metric
// +optional
PollingInterval *int32 `json:"pollingInterval,omitempty" description:"Polling interval (seconds) for the metric used for scaling (Default 15)"`
// (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
5 changes: 5 additions & 0 deletions operator/apis/http/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.PollingInterval,
)

// Set HTTPScaledObject instance as the owner and controller
Expand Down
7 changes: 6 additions & 1 deletion pkg/k8s/scaledobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func NewScaledObject(
minReplicas *int32,
maxReplicas *int32,
cooldownPeriod *int32,
pollingInterval *int32,
) *kedav1alpha1.ScaledObject {
if pollingInterval == nil {
pollingInterval = ptr.To[int32](soPollingInterval)
}

return &kedav1alpha1.ScaledObject{
TypeMeta: metav1.TypeMeta{
APIVersion: kedav1alpha1.SchemeGroupVersion.Identifier(),
Expand All @@ -45,7 +50,7 @@ func NewScaledObject(
Kind: workloadRef.Kind,
Name: workloadRef.Name,
},
PollingInterval: ptr.To[int32](soPollingInterval),
PollingInterval: pollingInterval,
CooldownPeriod: cooldownPeriod,
MinReplicaCount: minReplicas,
MaxReplicaCount: maxReplicas,
Expand Down
Loading