Allow scaling to zero if canary not enabled#215
Merged
avenski-ecovadis merged 2 commits intoJul 21, 2026
Conversation
kkubicki-ecovadis
self-requested a review
July 21, 2026 13:41
avenski-ecovadis
deleted the
fix/allow-scale-to-zero-if-canary-not-enabled
branch
July 23, 2026 06:01
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.
Description
Allow scale-to-zero (replicaCount: 0) on the dotnet-core chart without breaking helm upgrade.
Today the HPA template is unconditional (since #158), so setting replicaCount: 0 always fails with:
spec.minReplicas: Invalid value: 0: must be greater than or equal to 1
spec.maxReplicas: Invalid value: 0: must be greater than 0
This is a hard K8s constraint — Resource-metric (CPU/memory) HPAs can never scale to zero, regardless of chart config. #158 made HPA creation unconditional specifically because Flagger's
Canary CRD (autoscalerRef) requires the HPA to exist whenever canary.enabled: true; skipping it broke canary rollouts.
Fix: skip HPA creation only when replicaCount: 0 and canary is disabled — {{- if or .Values.global.canary.enabled (gt (.Values.global.replicaCount | int) 0) }}. Deployment already
renders replicas directly from replicaCount, so with HPA skipped, replicaCount: 0 now suspends the workload cleanly.
Canary + replicaCount: 0 still isn't supported (HPA still forced to exist to satisfy Flagger, still fails K8s validation) — that combination is fundamentally incompatible, not something
the chart can fix.
Chart
Select the chart that you are modifying:
Checklist
${CHART}/tests/*.py