fix(chart): suppress replicas when hpa is enabled#133
Open
kamiKAC wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
No issues found across 3 files
Architecture diagram
sequenceDiagram
participant HelmClient as Helm Client (CLI/CI)
participant Chart as n8n Helm Chart
participant Values as values.yaml / --set flags
participant TemplateEngine as Helm Template Engine
participant DeployYaml as Generated Deployment YAML
participant Kubernetes as Kubernetes API Server
participant HPA as HorizontalPodAutoscaler
Note over HelmClient,Kubernetes: Helm Chart Rendering Flow
HelmClient->>Chart: helm install/upgrade with values
Chart->>Values: Read .Values from values.yaml + CLI overrides
rect rgb(240, 240, 240)
Note over Values,DeployYaml: Per-component decision (main, worker, webhook-processor)
alt .Values.hpa.main.enabled == true
Values->>TemplateEngine: hpa.main.enabled=true
TemplateEngine->>TemplateEngine: CHANGED: Skip rendering replicas in deployment-main.yaml
TemplateEngine->>DeployYaml: Generate Deployment (no spec.replicas field)
DeployYaml-->>Kubernetes: Submit Deployment without replicas
Kubernetes->>HPA: HPA manages replica count
HPA->>Kubernetes: Set desired replicas based on metrics
else .Values.hpa.main.enabled == false
Values->>TemplateEngine: hpa.main.enabled=false
TemplateEngine->>TemplateEngine: CHANGED: Render replicas from .Values.replicaCount
TemplateEngine->>DeployYaml: Generate Deployment with spec.replicas=N
DeployYaml-->>Kubernetes: Submit Deployment with static replicas
Kubernetes->>Kubernetes: Start N pods (no HPA interference)
end
end
Note over Values,DeployYaml: Identical logic applies for worker and webhook-processor components
Kubernetes-->>HelmClient: Deployment created/updated (success)
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.
Pull Request
Description
Fixes replica handling in deployment templates so
spec.replicasis not rendered when HPA is enabled for that component.This prevents conflicts between Kubernetes HPA-managed scaling and statically defined replicas in the chart output.
Type of Change
Related Issues
Fixes # (issue)
Relates to # (issue)
Changes Made
charts/n8n/templates/deployment-main.yamlto renderreplicasonly whenhpa.main.enabledisfalse.charts/n8n/templates/deployment-worker.yamlto renderreplicasonly whenhpa.worker.enabledisfalse.charts/n8n/templates/deployment-webhook-processor.yamlto renderreplicasonly whenhpa.webhookProcessor.enabledisfalse.Testing Performed
Chart Validation
helm lint charts/n8npasses./scripts/validate-examples.shpassesDeployment Testing (if applicable)
Specific Testing for Changes
Describe any specific testing you performed for your changes:
helm lint charts/n8nsuccessfully.spec.replicaswhen the related HPA flag is enabled.Breaking Changes
If this includes breaking changes, describe what they are and provide migration instructions:
Documentation Updates
Checklist
Screenshots (if applicable)
Add screenshots to help explain your changes.
Additional Notes
replicasrendering for HPA-enabled deployments.Summary by cubic
Suppress spec.replicas in Helm deployment templates when HPA is enabled, so HPA controls scaling without conflicts. Applies to main, worker, and webhook-processor deployments.
Written for commit 6ba4942. Summary will update on new commits.