knative / knative/func

Expose KEDA ScaledObject and HTTP scaling configuration options

Open
#4,044 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
365
Forks
223
Avg merge
2d 3h
Merged PRs (30d)
25

Description

## Problem

Several KEDA scaling configuration values are currently hardcoded and not configurable via func.yaml.

### ScaledObject (Kafka trigger)

Hardcoded in `pkg/keda/kafka_scaling.go`:
- `cooldownPeriod`: 300 (seconds) — how long before scaling down after triggers go idle
- `pollingInterval`: not set, defaults to 30 seconds — how often KEDA checks metrics

Not exposed from KEDA's Kafka scaler:
- `offsetResetPolicy`
- `allowIdleConsumers`
- `excludePersistentLag`
- `scaleToZeroOnInvalidOffset`
- `limitToPartitionsWithLag`

### HTTPScaledObject (HTTP trigger)

Hardcoded in `pkg/keda/deployer.go`:
- `CooldownPeriod`: 300
- `ScalingMetric.Rate.TargetValue`: 100 (requests/sec)
- `ScalingMetric.Rate.Window`: 1 minute
- `ScalingMetric.Rate.Granularity`: 1 second

## Proposed solution

Add optional fields to `scale.keda` in func.yaml for the common options:

```yaml
deploy:
options:
scale:
keda:
pollingInterval: 15
cooldownPeriod: 60
triggers:
- type: kafka
lagThreshold: 5
- type: http
targetValue: 50
```

Start with `pollingInterval`, `cooldownPeriod`, and HTTP `targetValue` as the most impactful. The Kafka-specific options (`allowIdleConsumers`, etc.) can be added later as needed.

Contributor guide

Open the contributing guide

Research direction

Start with pkg/keda/kafka_scaling.go and pkg/keda/deployer.go, then trace how scale.keda options from func.yaml are represented and passed into these KEDA configurations. Implement the proposed optional pollingInterval, cooldownPeriod, and HTTP targetValue fields first, and verify that configured values replace the current defaults without changing behavior when omitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devops, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.