From 9b82e9bfa1fe51767e21386e16a7974cb70df8b2 Mon Sep 17 00:00:00 2001 From: Matteo Gazzetta Date: Tue, 1 Oct 2024 17:27:18 +0200 Subject: [PATCH] feat(deployment): allow setting replicas to zero #minor (#352) --- application/templates/deployment.yaml | 2 +- application/tests/deployment_test.yaml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 35ca0f49..4f5bfd23 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -20,7 +20,7 @@ metadata: name: {{ template "application.name" . }} namespace: {{ include "application.namespace" . }} spec: -{{- if .Values.deployment.replicas }} +{{- if not (eq .Values.deployment.replicas nil) }} replicas: {{ .Values.deployment.replicas }} {{- end }} selector: diff --git a/application/tests/deployment_test.yaml b/application/tests/deployment_test.yaml index 30baea1f..28f895d9 100644 --- a/application/tests/deployment_test.yaml +++ b/application/tests/deployment_test.yaml @@ -57,6 +57,14 @@ tests: path: metadata.labels["app.kubernetes.io/version"] value: example-tag + - it: allows setting replicas zero + set: + deployment.replicas: 0 + asserts: + - equal: + path: spec.replicas + value: 0 + - it: uses image digest when given set: deployment.image.repository: example-image