Skip to content

Allow scaling to zero if canary not enabled#215

Merged
avenski-ecovadis merged 2 commits into
masterfrom
fix/allow-scale-to-zero-if-canary-not-enabled
Jul 21, 2026
Merged

Allow scaling to zero if canary not enabled#215
avenski-ecovadis merged 2 commits into
masterfrom
fix/allow-scale-to-zero-if-canary-not-enabled

Conversation

@avenski-ecovadis

Copy link
Copy Markdown
Collaborator

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:

  • core
  • dotnet-core
  • cron-job
  • job
  • app-reverse-proxy
  • pact-broker
  • ado-build-agents
  • ado-agent-cleaner
  • event-worker

Checklist

  • Description provided
  • Linked issue
  • Chart version bumped
  • README.md updated with any new values or changes
  • Updated template tests in ${CHART}/tests/*.py

@avenski-ecovadis
avenski-ecovadis requested a review from a team as a code owner July 20, 2026 14:34
kkubicki-ecovadis

This comment was marked as resolved.

@kkubicki-ecovadis kkubicki-ecovadis self-assigned this Jul 21, 2026
@kkubicki-ecovadis
kkubicki-ecovadis self-requested a review July 21, 2026 13:41

@kkubicki-ecovadis kkubicki-ecovadis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apporved

@avenski-ecovadis
avenski-ecovadis merged commit 61c3707 into master Jul 21, 2026
1 check passed
@avenski-ecovadis
avenski-ecovadis deleted the fix/allow-scale-to-zero-if-canary-not-enabled branch July 23, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants