From 6779e493553a1b80806c2b0391bab0525a517ce2 Mon Sep 17 00:00:00 2001 From: jklein Date: Sat, 22 Aug 2026 08:12:40 +0200 Subject: [PATCH] Add per-workload replicas values and a chart-global scaleDown flag Every Deployment/StatefulSet now takes its replica count from a replicas value (default 1, explicit 0 allowed) via a new per-chart .replicas helper; the helper uses a kindIs "invalid" nil check so an explicit 0 is not swallowed by Helm's default function. A chart-global scaleDown flag (default false) takes precedence: it renders every workload with replicas: 0 and suspends the paperless-ngx consume CronJob, stopping the app without uninstalling it (PVCs, Secrets, Services and Ingress remain). Defaults leave the rendered manifests byte-identical to main, so all published charts get a minor version bump; the template-chart carries the reference helper implementation and stays unversioned. Fixes #25 --- README.md | 1 + apache-tika/Chart.yaml | 2 +- apache-tika/templates/_helpers.tpl | 31 +++++++++++++++++++ apache-tika/templates/deployment.yaml | 2 +- apache-tika/values.yaml | 11 ++++++- calibre-web-automated/Chart.yaml | 2 +- calibre-web-automated/templates/_helpers.tpl | 31 +++++++++++++++++++ .../templates/calibre-web-automated.sfs.yaml | 2 +- calibre-web-automated/values.yaml | 11 ++++++- cyberchef/Chart.yaml | 2 +- cyberchef/templates/_helpers.tpl | 31 +++++++++++++++++++ cyberchef/templates/cyberchef.deployment.yaml | 2 +- cyberchef/values.yaml | 11 ++++++- gotenberg/Chart.yaml | 2 +- gotenberg/templates/_helpers.tpl | 31 +++++++++++++++++++ gotenberg/templates/deployment.yaml | 2 +- gotenberg/values.yaml | 11 ++++++- homeassistant/Chart.yaml | 2 +- homeassistant/templates/_helpers.tpl | 31 +++++++++++++++++++ .../templates/homeassistant.sfs.yaml | 2 +- homeassistant/values.yaml | 12 ++++++- matrix-synapse/Chart.yaml | 2 +- matrix-synapse/templates/_helpers.tpl | 31 +++++++++++++++++++ .../matrix-delegation-nginx.deployment.yaml | 2 +- .../templates/matrix-synapse.sfs.yaml | 2 +- matrix-synapse/values.yaml | 14 ++++++++- outline/Chart.yaml | 2 +- outline/templates/_helpers.tpl | 31 +++++++++++++++++++ outline/templates/outline.sfs.yaml | 2 +- outline/values.yaml | 11 ++++++- paperless-ngx/Chart.yaml | 2 +- paperless-ngx/templates/_helpers.tpl | 31 +++++++++++++++++++ .../templates/paperless-consume.cronjob.yaml | 3 ++ .../templates/paperless-server.sfs.yaml | 2 +- paperless-ngx/values.yaml | 9 ++++++ patchmon/Chart.yaml | 2 +- patchmon/templates/_helpers.tpl | 31 +++++++++++++++++++ .../patchmon-backend.deployment.yaml | 2 +- .../patchmon-frontend.deployment.yaml | 2 +- patchmon/values.yaml | 14 ++++++++- rallly/Chart.yaml | 2 +- rallly/templates/_helpers.tpl | 31 +++++++++++++++++++ rallly/templates/rallly.deployment.yaml | 2 +- rallly/values.yaml | 11 ++++++- samba/Chart.yaml | 2 +- samba/templates/_helpers.tpl | 31 +++++++++++++++++++ samba/templates/samba.sfs.yaml | 2 +- samba/values.yaml | 11 ++++++- satisfactory/Chart.yaml | 2 +- satisfactory/templates/_helpers.tpl | 31 +++++++++++++++++++ .../templates/satisfactory-server.sfs.yaml | 2 +- satisfactory/values.yaml | 11 ++++++- teamspeak-server/Chart.yaml | 2 +- teamspeak-server/templates/_helpers.tpl | 31 +++++++++++++++++++ .../templates/teamspeak-server.sfs.yaml | 2 +- teamspeak-server/values.yaml | 12 ++++++- template-chart/templates/_helpers.tpl | 31 +++++++++++++++++++ template-chart/templates/xxx.deployment.yaml | 2 +- template-chart/templates/xxx.sfs.yaml | 2 +- template-chart/values.yaml | 11 ++++++- urlaubsverwaltung/Chart.yaml | 2 +- urlaubsverwaltung/templates/_helpers.tpl | 31 +++++++++++++++++++ .../urlaubsverwaltung.deployment.yaml | 2 +- urlaubsverwaltung/values.yaml | 11 ++++++- voucher-vault/Chart.yaml | 2 +- voucher-vault/templates/_helpers.tpl | 31 +++++++++++++++++++ .../templates/voucher-vault.sfs.yaml | 2 +- voucher-vault/values.yaml | 11 ++++++- zipline/Chart.yaml | 2 +- zipline/templates/_helpers.tpl | 31 +++++++++++++++++++ zipline/templates/zipline.sfs.yaml | 2 +- zipline/values.yaml | 11 ++++++- 72 files changed, 744 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index ffd0ddd..49bb41b 100644 --- a/README.md +++ b/README.md @@ -78,4 +78,5 @@ For runtime verification (do the workloads actually start, do probes/security se - `env` entries in `values.yaml` are rendered through `tpl`, so values may contain Helm templating; `value`, `secretKeyRef` and `configMapKeyRef` forms are supported. - Hardened defaults: `automountServiceAccountToken: false`, non-root user, `readOnlyRootFilesystem: true`, all capabilities dropped, probes and resource requests always set. Pod and container contexts are configurable via `securityContext.pod` / `securityContext.container` in each chart's values; writable paths (e.g. `/tmp`, nginx cache dirs, s6-overlay's `/run`) are emptyDirs. Where an image cannot satisfy the full standard (e.g. Home Assistant must start as root for s6-overlay, paperless needs a root init container to hand over `/run`), the deviation is minimal and justified with a comment in that chart's `values.yaml`. - Resource requests ship as chart defaults and are user-overridable; limits are computed by a per-chart `_helpers.tpl` helper (reference implementation in `template-chart/templates/_helpers.tpl`): an explicitly set limit always wins, missing memory and ephemeral-storage limits default to `resources.limitFactor` × the request (factor default `3`), and a CPU limit is only rendered when set explicitly — otherwise CPU stays unlimited (it is compressible, throttling instead of OOM-killing). The helper is duplicated into every chart because charts have no dependencies. +- Replica counts and scale-to-zero: every Deployment/StatefulSet has a `replicas` value (default `1`, the values path per workload matches its section, e.g. `patchmon.frontend.replicas`) that also accepts an explicit `0` for per-workload fine control. In addition, every chart has a global `scaleDown` flag (default `false`): `scaleDown: true` takes precedence over all `replicas` values, renders every Deployment/StatefulSet with `replicas: 0` and suspends CronJobs (paperless-ngx consume job). `scaleDown` **stops** the app but does not uninstall it — PVCs, Secrets, Services and Ingress stay in place, and setting it back to `false` brings the workloads back up. Implemented via a per-chart `.replicas` helper in `_helpers.tpl` (reference in `template-chart`); the helper uses an explicit nil check (`kindIs "invalid"`) because Helm's `default` would swallow an explicit `0`. - Charts have no dependencies (`charts/` directories are empty). diff --git a/apache-tika/Chart.yaml b/apache-tika/Chart.yaml index c205293..53cbdf8 100644 --- a/apache-tika/Chart.yaml +++ b/apache-tika/Chart.yaml @@ -4,5 +4,5 @@ description: A Helm chart to deploy Apache Tika on Kubernetes type: application -version: 7.0.0+up3.2.3.0.full +version: 7.1.0+up3.2.3.0.full appVersion: "3.2.3.0-full" diff --git a/apache-tika/templates/_helpers.tpl b/apache-tika/templates/_helpers.tpl index 5bbb4ab..6a321f0 100644 --- a/apache-tika/templates/_helpers.tpl +++ b/apache-tika/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "apache-tika.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "apache-tika.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/apache-tika/templates/deployment.yaml b/apache-tika/templates/deployment.yaml index bebe14e..cc595e8 100644 --- a/apache-tika/templates/deployment.yaml +++ b/apache-tika/templates/deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment spec: - replicas: 1 + replicas: {{ include "apache-tika.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.tika.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment diff --git a/apache-tika/values.yaml b/apache-tika/values.yaml index 2387666..5517bd5 100644 --- a/apache-tika/values.yaml +++ b/apache-tika/values.yaml @@ -1,4 +1,13 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + tika: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 # The official image runs as the dedicated user 35002:35002. /tmp is a # writable emptyDir because Tika writes temporary files while parsing. securityContext: @@ -44,4 +53,4 @@ tika: requests: cpu: 0.1 memory: 512Mi - ephemeralStorage: 10Mi \ No newline at end of file + ephemeralStorage: 10Mi diff --git a/calibre-web-automated/Chart.yaml b/calibre-web-automated/Chart.yaml index fea1ba4..f6f7870 100644 --- a/calibre-web-automated/Chart.yaml +++ b/calibre-web-automated/Chart.yaml @@ -4,7 +4,7 @@ type: application name: calibre-web-automated description: A Helm chart to deploy calibere-web-automated -version: 3.0.0+upv4.0.6 +version: 3.1.0+upv4.0.6 appVersion: v4.0.6 maintainers: diff --git a/calibre-web-automated/templates/_helpers.tpl b/calibre-web-automated/templates/_helpers.tpl index f55ea7f..7ec1c27 100644 --- a/calibre-web-automated/templates/_helpers.tpl +++ b/calibre-web-automated/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "calibre-web-automated.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "calibre-web-automated.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/calibre-web-automated/templates/calibre-web-automated.sfs.yaml b/calibre-web-automated/templates/calibre-web-automated.sfs.yaml index 1aef689..3cfc14e 100644 --- a/calibre-web-automated/templates/calibre-web-automated.sfs.yaml +++ b/calibre-web-automated/templates/calibre-web-automated.sfs.yaml @@ -6,7 +6,7 @@ metadata: app: {{ .Chart.Name }}-{{ .Release.Name }} spec: serviceName: {{ .Chart.Name }}-{{ .Release.Name }}-cwa-service - replicas: 1 + replicas: {{ include "calibre-web-automated.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.cwa.replicas) }} selector: matchLabels: app: {{ .Chart.Name }}-{{ .Release.Name }}-cwa-sfs diff --git a/calibre-web-automated/values.yaml b/calibre-web-automated/values.yaml index 91f29ca..5bc7277 100644 --- a/calibre-web-automated/values.yaml +++ b/calibre-web-automated/values.yaml @@ -1,7 +1,16 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: cwaSecretRef: null cwa: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 storage: 10Gi storageClass: longhorn timezone: "UTC" @@ -40,4 +49,4 @@ cwa: ingress: clusterIssuer: "letsencrypt-issuer" - domain: null \ No newline at end of file + domain: null diff --git a/cyberchef/Chart.yaml b/cyberchef/Chart.yaml index 5d28ea2..fec8e6a 100644 --- a/cyberchef/Chart.yaml +++ b/cyberchef/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy Cyberchef on Kubernetes type: application -version: 4.0.0+up10.22.1 +version: 4.1.0+up10.22.1 appVersion: "10.22.1" maintainers: diff --git a/cyberchef/templates/_helpers.tpl b/cyberchef/templates/_helpers.tpl index 1b9c098..9d7cd5e 100644 --- a/cyberchef/templates/_helpers.tpl +++ b/cyberchef/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "cyberchef.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "cyberchef.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/cyberchef/templates/cyberchef.deployment.yaml b/cyberchef/templates/cyberchef.deployment.yaml index ae7a155..70d81cc 100644 --- a/cyberchef/templates/cyberchef.deployment.yaml +++ b/cyberchef/templates/cyberchef.deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment spec: - replicas: 1 + replicas: {{ include "cyberchef.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.cyberchef.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment diff --git a/cyberchef/values.yaml b/cyberchef/values.yaml index 7655255..03f4289 100644 --- a/cyberchef/values.yaml +++ b/cyberchef/values.yaml @@ -1,4 +1,13 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + cyberchef: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 # The upstream image is stock nginx (root, listening on port 80). To still # run fully non-root, the pod runs as the image's nginx user (uid 101) and # the safe sysctl net.ipv4.ip_unprivileged_port_start=80 lets the unprivileged @@ -53,4 +62,4 @@ cyberchef: ingress: enabled: true clusterIssuer: letsencrypt - domain: null \ No newline at end of file + domain: null diff --git a/gotenberg/Chart.yaml b/gotenberg/Chart.yaml index 23c102c..d5ee226 100644 --- a/gotenberg/Chart.yaml +++ b/gotenberg/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy Gotenberg on Kubernetes type: application -version: 4.0.0+up8.26.0 +version: 4.1.0+up8.26.0 appVersion: "8.26.0" maintainers: diff --git a/gotenberg/templates/_helpers.tpl b/gotenberg/templates/_helpers.tpl index dc23056..fda42ef 100644 --- a/gotenberg/templates/_helpers.tpl +++ b/gotenberg/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "gotenberg.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "gotenberg.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/gotenberg/templates/deployment.yaml b/gotenberg/templates/deployment.yaml index 98be79f..341bcc7 100644 --- a/gotenberg/templates/deployment.yaml +++ b/gotenberg/templates/deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment spec: - replicas: 1 + replicas: {{ include "gotenberg.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.gotenberg.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment diff --git a/gotenberg/values.yaml b/gotenberg/values.yaml index 3ee8e62..758183a 100644 --- a/gotenberg/values.yaml +++ b/gotenberg/values.yaml @@ -1,4 +1,13 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + gotenberg: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 # The official image runs as the dedicated gotenberg user (uid 1001). /tmp # and /home/gotenberg are writable emptyDirs so Chromium/LibreOffice keep # working with a read-only root filesystem. @@ -45,4 +54,4 @@ gotenberg: requests: cpu: 0.1 memory: 512Mi - ephemeralStorage: 10Mi \ No newline at end of file + ephemeralStorage: 10Mi diff --git a/homeassistant/Chart.yaml b/homeassistant/Chart.yaml index 501cc54..340b06f 100644 --- a/homeassistant/Chart.yaml +++ b/homeassistant/Chart.yaml @@ -3,7 +3,7 @@ name: homeassistant description: A Helm chart to deploy Home Assistant on Kubernetes type: application -version: 4.0.0+up2026.2.3 +version: 4.1.0+up2026.2.3 appVersion: "2026.2.3" diff --git a/homeassistant/templates/_helpers.tpl b/homeassistant/templates/_helpers.tpl index abb8c76..2e27d1a 100644 --- a/homeassistant/templates/_helpers.tpl +++ b/homeassistant/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "homeassistant.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "homeassistant.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/homeassistant/templates/homeassistant.sfs.yaml b/homeassistant/templates/homeassistant.sfs.yaml index 7bd84c6..6e7d7b9 100644 --- a/homeassistant/templates/homeassistant.sfs.yaml +++ b/homeassistant/templates/homeassistant.sfs.yaml @@ -6,7 +6,7 @@ metadata: app: "{{ .Release.Name }}-{{ .Chart.Name }}" spec: serviceName: "{{ .Release.Name }}-{{ .Chart.Name }}-service" - replicas: 1 + replicas: {{ include "homeassistant.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.replicas) }} selector: matchLabels: app: "{{ .Release.Name }}-{{ .Chart.Name }}" diff --git a/homeassistant/values.yaml b/homeassistant/values.yaml index 124c8a1..dbf5796 100644 --- a/homeassistant/values.yaml +++ b/homeassistant/values.yaml @@ -1,3 +1,13 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + +# Replica count for this workload; 0 is allowed and scales it down. +# The chart-global scaleDown flag takes precedence. +replicas: 1 + # This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ service: # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types @@ -107,4 +117,4 @@ core: # - http-config # - recorder-config secrets: - configSecretRef: null \ No newline at end of file + configSecretRef: null diff --git a/matrix-synapse/Chart.yaml b/matrix-synapse/Chart.yaml index 91dbd06..05842cd 100644 --- a/matrix-synapse/Chart.yaml +++ b/matrix-synapse/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: matrix-synapse description: A Helm chart to deploy a Matrix Synapse server on Kubernetes type: application -version: 4.0.0+upv1.149.1 +version: 4.1.0+upv1.149.1 appVersion: "v1.149.1" maintainers: - name: jklein \ No newline at end of file diff --git a/matrix-synapse/templates/_helpers.tpl b/matrix-synapse/templates/_helpers.tpl index 523b1bb..a8c5a76 100644 --- a/matrix-synapse/templates/_helpers.tpl +++ b/matrix-synapse/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "matrix-synapse.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "matrix-synapse.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/matrix-synapse/templates/matrix-delegation-nginx.deployment.yaml b/matrix-synapse/templates/matrix-delegation-nginx.deployment.yaml index 527ddee..d821685 100644 --- a/matrix-synapse/templates/matrix-delegation-nginx.deployment.yaml +++ b/matrix-synapse/templates/matrix-delegation-nginx.deployment.yaml @@ -6,7 +6,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx spec: - replicas: 1 + replicas: {{ include "matrix-synapse.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.matrix.delegation.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-delegation-nginx diff --git a/matrix-synapse/templates/matrix-synapse.sfs.yaml b/matrix-synapse/templates/matrix-synapse.sfs.yaml index 7c36a24..eade2d5 100644 --- a/matrix-synapse/templates/matrix-synapse.sfs.yaml +++ b/matrix-synapse/templates/matrix-synapse.sfs.yaml @@ -6,7 +6,7 @@ metadata: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs spec: serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service - replicas: 1 + replicas: {{ include "matrix-synapse.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.matrix.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs diff --git a/matrix-synapse/values.yaml b/matrix-synapse/values.yaml index c3a458c..614cab8 100644 --- a/matrix-synapse/values.yaml +++ b/matrix-synapse/values.yaml @@ -1,8 +1,20 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + matrix: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 serverName: null timezone: UTC configSecretRef: null delegation: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 enabled: false serverUrl: null # The delegation nginx runs as the image's unprivileged nginx user @@ -45,4 +57,4 @@ storage: ingress: domain: null - clusterIssuer: null \ No newline at end of file + clusterIssuer: null diff --git a/outline/Chart.yaml b/outline/Chart.yaml index d13c211..b181cce 100644 --- a/outline/Chart.yaml +++ b/outline/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy Outline on Kubernetes type: application -version: 3.0.0+up1.9.2 +version: 3.1.0+up1.9.2 appVersion: 1.9.2 maintainers: diff --git a/outline/templates/_helpers.tpl b/outline/templates/_helpers.tpl index 9fb1504..32600a6 100644 --- a/outline/templates/_helpers.tpl +++ b/outline/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "outline.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "outline.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/outline/templates/outline.sfs.yaml b/outline/templates/outline.sfs.yaml index 3af1530..f2b91df 100644 --- a/outline/templates/outline.sfs.yaml +++ b/outline/templates/outline.sfs.yaml @@ -6,7 +6,7 @@ metadata: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs spec: serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service - replicas: 1 + replicas: {{ include "outline.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.outline.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs diff --git a/outline/values.yaml b/outline/values.yaml index cd11687..8054736 100644 --- a/outline/values.yaml +++ b/outline/values.yaml @@ -1,8 +1,17 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: configSecretRef: null redisSecretRef: null dbSecretRef: null outline: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 maxUploadSize: '262144000' forceHttps: 'false' oidc: @@ -23,4 +32,4 @@ outline: ingress: maxUploadFileSize: 25m clusterIssuer: letsencrypt - domain: null \ No newline at end of file + domain: null diff --git a/paperless-ngx/Chart.yaml b/paperless-ngx/Chart.yaml index 0752716..c36e488 100644 --- a/paperless-ngx/Chart.yaml +++ b/paperless-ngx/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy Paperless-NGX on Kubernetes type: application -version: 7.0.0+up2.20.13 +version: 7.1.0+up2.20.13 appVersion: 2.20.13 diff --git a/paperless-ngx/templates/_helpers.tpl b/paperless-ngx/templates/_helpers.tpl index e79cdd3..b4029b9 100644 --- a/paperless-ngx/templates/_helpers.tpl +++ b/paperless-ngx/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "paperless-ngx.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "paperless-ngx.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/paperless-ngx/templates/paperless-consume.cronjob.yaml b/paperless-ngx/templates/paperless-consume.cronjob.yaml index e76ee40..6e1eb68 100644 --- a/paperless-ngx/templates/paperless-consume.cronjob.yaml +++ b/paperless-ngx/templates/paperless-consume.cronjob.yaml @@ -5,6 +5,9 @@ metadata: name: {{ .Release.Name }}-{{ .Chart.Name }}-consume-cronjob spec: schedule: {{ .Values.smbConnection.cronJob }} + {{- if .Values.scaleDown }} + suspend: true + {{- end }} jobTemplate: spec: template: diff --git a/paperless-ngx/templates/paperless-server.sfs.yaml b/paperless-ngx/templates/paperless-server.sfs.yaml index 69d1bbd..ffa9adb 100644 --- a/paperless-ngx/templates/paperless-server.sfs.yaml +++ b/paperless-ngx/templates/paperless-server.sfs.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs spec: - replicas: 1 + replicas: {{ include "paperless-ngx.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.paperless.replicas) }} serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service selector: matchLabels: diff --git a/paperless-ngx/values.yaml b/paperless-ngx/values.yaml index c3db1db..48619c9 100644 --- a/paperless-ngx/values.yaml +++ b/paperless-ngx/values.yaml @@ -1,3 +1,9 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: redisRef: null databaseRef: null @@ -10,6 +16,9 @@ ingress: domain: null paperless: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 ocr: languages: "eng" mode: "skip" diff --git a/patchmon/Chart.yaml b/patchmon/Chart.yaml index f3701fc..8e5ef23 100644 --- a/patchmon/Chart.yaml +++ b/patchmon/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy Patchmon on Kubernetes type: application -version: 4.0.0+up1.4.2 +version: 4.1.0+up1.4.2 appVersion: "1.4.2" maintainers: diff --git a/patchmon/templates/_helpers.tpl b/patchmon/templates/_helpers.tpl index b58049e..7472cc3 100644 --- a/patchmon/templates/_helpers.tpl +++ b/patchmon/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "patchmon.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "patchmon.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/patchmon/templates/patchmon-backend.deployment.yaml b/patchmon/templates/patchmon-backend.deployment.yaml index 46e7363..4646209 100644 --- a/patchmon/templates/patchmon-backend.deployment.yaml +++ b/patchmon/templates/patchmon-backend.deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-backend spec: - replicas: 1 + replicas: {{ include "patchmon.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.patchmon.backend.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-backend diff --git a/patchmon/templates/patchmon-frontend.deployment.yaml b/patchmon/templates/patchmon-frontend.deployment.yaml index ce85354..b401b4f 100644 --- a/patchmon/templates/patchmon-frontend.deployment.yaml +++ b/patchmon/templates/patchmon-frontend.deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-frontend spec: - replicas: 1 + replicas: {{ include "patchmon.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.patchmon.frontend.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-frontend diff --git a/patchmon/values.yaml b/patchmon/values.yaml index b671621..6a9c357 100644 --- a/patchmon/values.yaml +++ b/patchmon/values.yaml @@ -1,8 +1,17 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + patchmon: storage: size: 10Gi storageClass: null frontend: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 # The frontend image is based on nginx-unprivileged; the pod runs as its # nginx user (uid 101). The image's root-only init script (it would chown # the shared assets volume) is replaced by fsGroup 1000: the same group @@ -31,6 +40,9 @@ patchmon: memory: 128Mi ephemeral-storage: 10Mi backend: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 resources: # Limits are optional: memory and ephemeral-storage limits default to # limitFactor x the request, an explicitly set limit always wins, and a @@ -49,4 +61,4 @@ secrets: redisSecretRef: null postgresSecretRef: null oidcSecretRef: null - patchmonSecretRef: null \ No newline at end of file + patchmonSecretRef: null diff --git a/rallly/Chart.yaml b/rallly/Chart.yaml index 611b776..3b5395c 100644 --- a/rallly/Chart.yaml +++ b/rallly/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy Rallly on Kubernetes type: application -version: 3.0.0+up4.8.1 +version: 3.1.0+up4.8.1 appVersion: "4.8.1" maintainers: diff --git a/rallly/templates/_helpers.tpl b/rallly/templates/_helpers.tpl index 0c01a8d..81cfde3 100644 --- a/rallly/templates/_helpers.tpl +++ b/rallly/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "rallly.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "rallly.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/rallly/templates/rallly.deployment.yaml b/rallly/templates/rallly.deployment.yaml index 2817f09..d9ef0a6 100644 --- a/rallly/templates/rallly.deployment.yaml +++ b/rallly/templates/rallly.deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }} spec: - replicas: 1 + replicas: {{ include "rallly.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.rallly.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }} diff --git a/rallly/values.yaml b/rallly/values.yaml index 2dcd478..75659ac 100644 --- a/rallly/values.yaml +++ b/rallly/values.yaml @@ -1,3 +1,9 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: ralllySecretRef: null oidcSecretRef: null @@ -5,6 +11,9 @@ secrets: smtpSecretRef: null rallly: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 smtp: enabled: false allowedEmails: '*' @@ -49,4 +58,4 @@ rallly: ingress: clusterIssuer: null - domain: null \ No newline at end of file + domain: null diff --git a/samba/Chart.yaml b/samba/Chart.yaml index 35bf24a..2b439ad 100644 --- a/samba/Chart.yaml +++ b/samba/Chart.yaml @@ -4,6 +4,6 @@ description: A Helm chart for Samba type: application -version: 3.0.0+up4.23.5 +version: 3.1.0+up4.23.5 appVersion: 4.23.5 diff --git a/samba/templates/_helpers.tpl b/samba/templates/_helpers.tpl index edfcb21..bf82e94 100644 --- a/samba/templates/_helpers.tpl +++ b/samba/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "samba.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "samba.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/samba/templates/samba.sfs.yaml b/samba/templates/samba.sfs.yaml index 6d893f6..7eb04cc 100644 --- a/samba/templates/samba.sfs.yaml +++ b/samba/templates/samba.sfs.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs spec: - replicas: 1 + replicas: {{ include "samba.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.samba.replicas) }} serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service selector: matchLabels: diff --git a/samba/values.yaml b/samba/values.yaml index a9d5c1b..bdb0a66 100644 --- a/samba/values.yaml +++ b/samba/values.yaml @@ -1,7 +1,16 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: sambaUsersRef: null samba: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 shares: - name: null validUsers: null @@ -38,4 +47,4 @@ samba: ephemeralStorage: 50Mi globalConfig: null - storageClass: longhorn \ No newline at end of file + storageClass: longhorn diff --git a/satisfactory/Chart.yaml b/satisfactory/Chart.yaml index 6f2c29a..767fc23 100644 --- a/satisfactory/Chart.yaml +++ b/satisfactory/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: satisfactory description: A Helm chart to deploy a Satisfactory Gameserver on Kubernetes type: application -version: 3.0.0+upv1.9.10 +version: 3.1.0+upv1.9.10 appVersion: "v1.9.10" maintainers: - name: jklein \ No newline at end of file diff --git a/satisfactory/templates/_helpers.tpl b/satisfactory/templates/_helpers.tpl index 0766483..3741f79 100644 --- a/satisfactory/templates/_helpers.tpl +++ b/satisfactory/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "satisfactory.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "satisfactory.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/satisfactory/templates/satisfactory-server.sfs.yaml b/satisfactory/templates/satisfactory-server.sfs.yaml index 0aecd63..6cf9e55 100644 --- a/satisfactory/templates/satisfactory-server.sfs.yaml +++ b/satisfactory/templates/satisfactory-server.sfs.yaml @@ -7,7 +7,7 @@ spec: matchLabels: app: "{{ .Release.Name }}-{{ .Chart.Name }}-sf-server" serviceName: "{{ .Release.Name }}-{{ .Chart.Name }}-sf-service" - replicas: 1 + replicas: {{ include "satisfactory.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.server.replicas) }} template: metadata: labels: diff --git a/satisfactory/values.yaml b/satisfactory/values.yaml index 74399f6..247dcec 100644 --- a/satisfactory/values.yaml +++ b/satisfactory/values.yaml @@ -1,3 +1,9 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + dev: debug: false @@ -7,6 +13,9 @@ game: seasonalEvents: true server: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 gamePort: 30777 messagingPort: 30888 storage: 20Gi @@ -20,4 +29,4 @@ server: requests: memory: "4Gi" cpu: "1" - ephemeral-storage: "5Gi" \ No newline at end of file + ephemeral-storage: "5Gi" diff --git a/teamspeak-server/Chart.yaml b/teamspeak-server/Chart.yaml index d3da79b..e88cbb9 100644 --- a/teamspeak-server/Chart.yaml +++ b/teamspeak-server/Chart.yaml @@ -4,5 +4,5 @@ description: A Helm chart for deploying a teamspeak-server on Kubernetes type: application -version: 3.0.0+upv6.0.0.beta8 +version: 3.1.0+upv6.0.0.beta8 appVersion: "v6.0.0-beta8" diff --git a/teamspeak-server/templates/_helpers.tpl b/teamspeak-server/templates/_helpers.tpl index 4a83f50..e0f5d5f 100644 --- a/teamspeak-server/templates/_helpers.tpl +++ b/teamspeak-server/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "teamspeak-server.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "teamspeak-server.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/teamspeak-server/templates/teamspeak-server.sfs.yaml b/teamspeak-server/templates/teamspeak-server.sfs.yaml index ffd3e84..26205ee 100644 --- a/teamspeak-server/templates/teamspeak-server.sfs.yaml +++ b/teamspeak-server/templates/teamspeak-server.sfs.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }} spec: - replicas: 1 + replicas: {{ include "teamspeak-server.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-server-sfs diff --git a/teamspeak-server/values.yaml b/teamspeak-server/values.yaml index c42e098..03a2c05 100644 --- a/teamspeak-server/values.yaml +++ b/teamspeak-server/values.yaml @@ -1,3 +1,13 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + +# Replica count for this workload; 0 is allowed and scales it down. +# The chart-global scaleDown flag takes precedence. +replicas: 1 + resources: # Limits are optional: memory and ephemeral-storage limits default to # limitFactor x the request, an explicitly set limit always wins, and a @@ -10,4 +20,4 @@ resources: storage: size: 25Gi - storageClass: longhorn \ No newline at end of file + storageClass: longhorn diff --git a/template-chart/templates/_helpers.tpl b/template-chart/templates/_helpers.tpl index 718c203..5342f44 100644 --- a/template-chart/templates/_helpers.tpl +++ b/template-chart/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "xxx.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "xxx.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/template-chart/templates/xxx.deployment.yaml b/template-chart/templates/xxx.deployment.yaml index 7224196..0108b2e 100644 --- a/template-chart/templates/xxx.deployment.yaml +++ b/template-chart/templates/xxx.deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment spec: - replicas: 1 + replicas: {{ include "xxx.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.xxx.replicas) }} selector: matchLabels: app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment diff --git a/template-chart/templates/xxx.sfs.yaml b/template-chart/templates/xxx.sfs.yaml index abf1372..231cb2f 100644 --- a/template-chart/templates/xxx.sfs.yaml +++ b/template-chart/templates/xxx.sfs.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs spec: - replicas: 1 + replicas: {{ include "xxx.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.xxx.replicas) }} serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service selector: matchLabels: diff --git a/template-chart/values.yaml b/template-chart/values.yaml index 829e27c..cf1fa52 100644 --- a/template-chart/values.yaml +++ b/template-chart/values.yaml @@ -1,7 +1,16 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: xxxSecretRef: null xxx: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 resources: # Limits are optional: memory and ephemeral-storage limits default to # limitFactor x the request, an explicitly set limit always wins, and a @@ -74,4 +83,4 @@ storage: ingress: enabled: true clusterIssuer: null - domain: null \ No newline at end of file + domain: null diff --git a/urlaubsverwaltung/Chart.yaml b/urlaubsverwaltung/Chart.yaml index 5a13528..462015b 100644 --- a/urlaubsverwaltung/Chart.yaml +++ b/urlaubsverwaltung/Chart.yaml @@ -3,5 +3,5 @@ name: urlaubsverwaltung description: A Helm chart to deploy urlaubsverwaltung on Kubernetes type: application -version: 4.0.0+up6.5.0 +version: 4.1.0+up6.5.0 appVersion: 6.5.0 diff --git a/urlaubsverwaltung/templates/_helpers.tpl b/urlaubsverwaltung/templates/_helpers.tpl index ffc2dc9..bf1eb16 100644 --- a/urlaubsverwaltung/templates/_helpers.tpl +++ b/urlaubsverwaltung/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "urlaubsverwaltung.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "urlaubsverwaltung.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/urlaubsverwaltung/templates/urlaubsverwaltung.deployment.yaml b/urlaubsverwaltung/templates/urlaubsverwaltung.deployment.yaml index 0e882bb..3935eeb 100644 --- a/urlaubsverwaltung/templates/urlaubsverwaltung.deployment.yaml +++ b/urlaubsverwaltung/templates/urlaubsverwaltung.deployment.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Chart.Name }}-{{ .Release.Name }} spec: - replicas: 1 + replicas: {{ include "urlaubsverwaltung.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.urlaubsverwaltung.replicas) }} selector: matchLabels: app: {{ .Chart.Name }}-{{ .Release.Name }}-uv-deployment diff --git a/urlaubsverwaltung/values.yaml b/urlaubsverwaltung/values.yaml index fc22e02..4623cb7 100644 --- a/urlaubsverwaltung/values.yaml +++ b/urlaubsverwaltung/values.yaml @@ -1,3 +1,9 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: databaseSecretRef: null oidcSecretRef: null @@ -7,6 +13,9 @@ ingress: domain: null urlaubsverwaltung: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 # The official image is built with Cloud Native Buildpacks and runs as the # non-root cnb user (uid 1002, gid 1001). /tmp is a writable emptyDir for # the JVM's temp/work files. @@ -30,4 +39,4 @@ urlaubsverwaltung: requests: cpu: 0.1 memory: 768Mi - ephemeralStorage: 10Mi \ No newline at end of file + ephemeralStorage: 10Mi diff --git a/voucher-vault/Chart.yaml b/voucher-vault/Chart.yaml index 7a767ca..d53bc44 100644 --- a/voucher-vault/Chart.yaml +++ b/voucher-vault/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart to deploy VoucherVault on Kubernetes type: application -version: 3.0.0+up1.27.4 +version: 3.1.0+up1.27.4 appVersion: "1.27.4" maintainers: diff --git a/voucher-vault/templates/_helpers.tpl b/voucher-vault/templates/_helpers.tpl index 7827952..841efc1 100644 --- a/voucher-vault/templates/_helpers.tpl +++ b/voucher-vault/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "voucher-vault.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "voucher-vault.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/voucher-vault/templates/voucher-vault.sfs.yaml b/voucher-vault/templates/voucher-vault.sfs.yaml index 27015bf..22a303d 100644 --- a/voucher-vault/templates/voucher-vault.sfs.yaml +++ b/voucher-vault/templates/voucher-vault.sfs.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs spec: - replicas: 1 + replicas: {{ include "voucher-vault.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.voucherVault.replicas) }} serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service selector: matchLabels: diff --git a/voucher-vault/values.yaml b/voucher-vault/values.yaml index ab5bec8..ff668fd 100644 --- a/voucher-vault/values.yaml +++ b/voucher-vault/values.yaml @@ -1,9 +1,18 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + secrets: voucherVaultSecretRef: null oidcSecretRef: null databaseSecretRef: null voucherVault: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 resources: # Limits are optional: memory and ephemeral-storage limits default to # limitFactor x the request, an explicitly set limit always wins, and a @@ -175,4 +184,4 @@ storage: ingress: enabled: true clusterIssuer: null - domain: null \ No newline at end of file + domain: null diff --git a/zipline/Chart.yaml b/zipline/Chart.yaml index 2ea87e7..58c3673 100644 --- a/zipline/Chart.yaml +++ b/zipline/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 4.0.0+up4.6.4 +version: 4.1.0+up4.6.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/zipline/templates/_helpers.tpl b/zipline/templates/_helpers.tpl index df273d7..48affbc 100644 --- a/zipline/templates/_helpers.tpl +++ b/zipline/templates/_helpers.tpl @@ -83,3 +83,34 @@ results are printed without a decimal point. {{- printf "%v%s" $product $suffix -}} {{- end -}} {{- end -}} + +{{/* +Render the replica count for a Deployment/StatefulSet. + +Input: dict + "scaleDown" the chart-global .Values.scaleDown flag (may be nil) + "replicas" the workload's replicas value (may be nil) + +Rules (issue #25): + - scaleDown: true takes precedence and always yields 0. + - otherwise an explicitly set replicas value is used as given, including an + explicit 0 — Helm's "default" would swallow 0, hence the explicit + kindIs "invalid" nil check. + - a missing replicas value defaults to 1. + +Usage (the values path to the workload's replicas varies per chart): + replicas: {{ include "zipline.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values..replicas) }} + +NOTE: like the resources helper above, this is duplicated into every chart's +templates/_helpers.tpl with the chart's name as define prefix. This file in +template-chart is the reference implementation. +*/}} +{{- define "zipline.replicas" -}} +{{- if .scaleDown -}} +0 +{{- else if not (kindIs "invalid" .replicas) -}} +{{- .replicas -}} +{{- else -}} +1 +{{- end -}} +{{- end -}} diff --git a/zipline/templates/zipline.sfs.yaml b/zipline/templates/zipline.sfs.yaml index f54cb2b..0b4be75 100644 --- a/zipline/templates/zipline.sfs.yaml +++ b/zipline/templates/zipline.sfs.yaml @@ -7,7 +7,7 @@ spec: matchLabels: app: "{{ .Release.Name }}-{{ .Chart.Name }}-sfs" serviceName: "{{ .Release.Name }}-{{ .Chart.Name }}-service" - replicas: 1 + replicas: {{ include "zipline.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.zipline.replicas) }} template: metadata: labels: diff --git a/zipline/values.yaml b/zipline/values.yaml index c47b5d8..81a5caa 100644 --- a/zipline/values.yaml +++ b/zipline/values.yaml @@ -1,3 +1,9 @@ +# Scale the whole chart down without uninstalling it: scaleDown: true renders +# every Deployment/StatefulSet with replicas: 0 (and suspends CronJobs) and +# takes precedence over any per-workload replicas value. PVCs, Secrets and +# Services stay in place; scaleDown: false brings the workloads back up. +scaleDown: false + config: storage: 50Gi storageClass: longhorn @@ -7,6 +13,9 @@ config: domain: null maxUploadFileSize: 30m zipline: + # Replica count for this workload; 0 is allowed and scales it down. + # The chart-global scaleDown flag takes precedence. + replicas: 1 # The upstream image ships no dedicated user, but the Node.js server runs # fine as an arbitrary non-root uid; fsGroup makes the uploads PVC writable. securityContext: @@ -58,4 +67,4 @@ zipline: requests: cpu: 0.1 memory: 265Mi - ephemeralStorage: 100Mi \ No newline at end of file + ephemeralStorage: 100Mi