Repository navigation
Allow customization of how keda scales up and down instead of allowin… - #282
Open
PedroMiguelFMoreira wants to merge 4 commits into
Open
PedroMiguelFMoreira wants to merge 4 commits into
PedroMiguelFMoreira wants to merge 4 commits into
Conversation
…g it to scale 100% right away.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Architecture diagram
sequenceDiagram
participant User as Helm User
participant Helm as Helm Chart
participant K8s as Kubernetes API
participant KEDA as KEDA Operator
participant HPA as HPA Controller
participant Deploy as Worker/Webhook Deployment
User->>Helm: Provide values.yaml with keda.worker.advanced
Note over Helm: NEW: Advanced config passthrough
alt Worker ScaledObject
Helm->>K8s: Render scaledobject-worker.yaml with advanced block
else Webhook Processor ScaledObject
User->>Helm: Provide keda.webhookProcessor.advanced
Helm->>K8s: Render scaledobject-webhook-processor.yaml with advanced block
end
Note over K8s: ScaledObject created with advanced config
K8s->>KEDA: Watch ScaledObject
KEDA->>KEDA: Evaluate triggers (Redis queue depth)
KEDA->>HPA: NEW: Compute target replica count per behavior policies
alt Scale up with behavior policy (e.g., 2 pods/min)
HPA->>HPA: NEW: Apply scaleUp policies (max 2 pods/min)
HPA->>Deploy: Scale replicas incrementally
else Scale down with stabilization (e.g., 300s window)
HPA->>HPA: CHANGED: Wait stabilization window (300s)
HPA->>Deploy: Remove at most 1 pod/min
else Default behavior (no advanced config)
HPA->>Deploy: Scale directly to target replicas
end
Deploy-->>HPA: Current replica count
HPA-->>KEDA: Status update
KEDA-->>K8s: Update ScaledObject status
K8s-->>User: Helm release status
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.
View guided diff | Re-trigger cubic
Contributor
Author
|
Hello @TMWilds not sure if I can ask you for your help once again, if you could review this PR I would appreciate it. 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow customization of how KEDA scales workers and webhook processors up and down, instead of jumping straight to the computed replica count.
Description
When KEDA is enabled with
minReplicaCount >= 1, replica changes between min and max are handled by the Kubernetes HPA. By default, the HPA can scale directly to the target count in a single step (e.g. 3→20 on scale-up or 20→3 on scale-down), which can cause sudden capacity swings and disrupt in-flight workflow executions.This change exposes KEDA's
advancedScaledObject configuration on both worker and webhook-processor ScaledObjects via new values:keda.worker.advancedkeda.webhookProcessor.advancedWhen set, these are rendered into the ScaledObject's
spec.advancedblock (typicallyhorizontalPodAutoscalerConfig.behavior) so operators can cap how many pods are added or removed per interval. Default remains{}, preserving existing behavior for current deployments.Type of Change
Related Issues
Fixes # (issue)
Relates to # (issue)
Testing Performed
Deployment Testing (if applicable)
Specific Testing for Changes
Describe any specific testing you performed for your changes:
helm template test charts/n8n -f charts/n8n/examples/keda-autoscaling.yaml --dry-run=client— renders successfully withadvanced: {}(noadvancedblock in ScaledObject)spec.advancedonly whenkeda.worker.advanced/keda.webhookProcessor.advancedis non-empty{}leaves existing KEDA Redis scaling behavior unchangedBreaking Changes
If this includes breaking changes, describe what they are and provide migration instructions:
advanceddefaults to{}and is omitted from rendered ScaledObjects unless configured.Checklist