Merge pull request #31 from jk-cluster/feat/auto-limits

Compute memory/ephemeral-storage limits from requests, drop default CPU limits
This commit is contained in:
jklein authored and GitHub committed 2026-08-21 21:37:24 +00:00
commit 9a00149ea6
72 files changed
+1580 -226

No files matched your search

+2 -1
View File
@@ -76,5 +76,6 @@ For runtime verification (do the workloads actually start, do probes/security se
- Secrets are **1Password `OnePasswordItem` CRs**: values expose `secrets.<name>SecretRef` holding an `op://` item path; the 1Password operator materializes the Kubernetes Secret in-cluster. - Secrets are **1Password `OnePasswordItem` CRs**: values expose `secrets.<name>SecretRef` holding an `op://` item path; the 1Password operator materializes the Kubernetes Secret in-cluster.
- Ingress assumes ingress-nginx (`ingressClassName: nginx`) and cert-manager: `ingress.clusterIssuer` and `ingress.domain` are required values; the TLS secret is named `tls-<release>-<chart>-ingress`. - Ingress assumes ingress-nginx (`ingressClassName: nginx`) and cert-manager: `ingress.clusterIssuer` and `ingress.domain` are required values; the TLS secret is named `tls-<release>-<chart>-ingress`.
- `env` entries in `values.yaml` are rendered through `tpl`, so values may contain Helm templating; `value`, `secretKeyRef` and `configMapKeyRef` forms are supported. - `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/limits 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`. - 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.
- Charts have no dependencies (`charts/` directories are empty). - Charts have no dependencies (`charts/` directories are empty).
+1 -1
View File
@@ -4,5 +4,5 @@ description: A Helm chart to deploy Apache Tika on Kubernetes
type: application type: application
version: 6.0.0+up3.2.3.0.full version: 7.0.0+up3.2.3.0.full
appVersion: "3.2.3.0-full" appVersion: "3.2.3.0-full"
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "apache-tika.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "apache-tika.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "apache-tika.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "apache-tika.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "apache-tika.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "apache-tika.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -8
View File
@@ -40,14 +40,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.tika.startupProbe | nindent 12 }} {{- toYaml .Values.tika.startupProbe | nindent 12 }}
resources: resources:
requests: {{- include "apache-tika.resources" .Values.tika.resources | nindent 12 }}
memory: "{{ .Values.tika.resources.requests.memory }}"
cpu: "{{ .Values.tika.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.tika.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.tika.resources.limits.memory }}"
cpu: "{{ .Values.tika.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.tika.resources.limits.ephemeralStorage }}"
volumes: volumes:
- name: tmp - name: tmp
emptyDir: {} emptyDir: {}
+5 -5
View File
@@ -37,11 +37,11 @@ tika:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeralStorage: 10Mi ephemeralStorage: 10Mi
limits:
cpu: 100m
memory: 768Mi
ephemeralStorage: 100Mi
+1 -1
View File
@@ -4,7 +4,7 @@ type: application
name: calibre-web-automated name: calibre-web-automated
description: A Helm chart to deploy calibere-web-automated description: A Helm chart to deploy calibere-web-automated
version: 2.0.1+upv4.0.6 version: 3.0.0+upv4.0.6
appVersion: v4.0.6 appVersion: v4.0.6
maintainers: maintainers:
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "calibre-web-automated.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "calibre-web-automated.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "calibre-web-automated.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "calibre-web-automated.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "calibre-web-automated.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "calibre-web-automated.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -62,14 +62,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.cwa.startupProbe | nindent 12 }} {{- toYaml .Values.cwa.startupProbe | nindent 12 }}
resources: resources:
requests: {{- include "calibre-web-automated.resources" .Values.cwa.resources | nindent 12 }}
memory: "{{ .Values.cwa.resources.requests.memory }}"
cpu: "{{ .Values.cwa.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.cwa.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.cwa.resources.limits.memory }}"
cpu: "{{ .Values.cwa.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.cwa.resources.limits.ephemeralStorage }}"
automountServiceAccountToken: false automountServiceAccountToken: false
securityContext: securityContext:
fsGroup: 1000 fsGroup: 1000
+4 -4
View File
@@ -29,14 +29,14 @@ cwa:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeralStorage: 100Mi ephemeralStorage: 100Mi
limits:
cpu: 1
memory: 1024Mi
ephemeralStorage: 200Mi
ingress: ingress:
clusterIssuer: "letsencrypt-issuer" clusterIssuer: "letsencrypt-issuer"
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy Cyberchef on Kubernetes
type: application type: application
version: 3.0.0+up10.22.1 version: 4.0.0+up10.22.1
appVersion: "10.22.1" appVersion: "10.22.1"
maintainers: maintainers:
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "cyberchef.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "cyberchef.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "cyberchef.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "cyberchef.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "cyberchef.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "cyberchef.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -42,14 +42,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.cyberchef.startupProbe | nindent 12 }} {{- toYaml .Values.cyberchef.startupProbe | nindent 12 }}
resources: resources:
requests: {{- include "cyberchef.resources" .Values.cyberchef.resources | nindent 12 }}
memory: "{{ .Values.cyberchef.resources.requests.memory }}"
cpu: "{{ .Values.cyberchef.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.cyberchef.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.cyberchef.resources.limits.memory }}"
cpu: "{{ .Values.cyberchef.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.cyberchef.resources.limits.ephemeralStorage }}"
volumes: volumes:
- name: nginx-cache - name: nginx-cache
emptyDir: {} emptyDir: {}
+4 -4
View File
@@ -41,14 +41,14 @@ cyberchef:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeralStorage: 10Mi ephemeralStorage: 10Mi
limits:
cpu: 1
memory: 768Mi
ephemeralStorage: 100Mi
ingress: ingress:
enabled: true enabled: true
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy Gotenberg on Kubernetes
type: application type: application
version: 3.0.0+up8.26.0 version: 4.0.0+up8.26.0
appVersion: "8.26.0" appVersion: "8.26.0"
maintainers: maintainers:
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "gotenberg.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "gotenberg.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "gotenberg.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "gotenberg.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "gotenberg.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "gotenberg.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -8
View File
@@ -43,14 +43,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.gotenberg.startupProbe | nindent 12 }} {{- toYaml .Values.gotenberg.startupProbe | nindent 12 }}
resources: resources:
requests: {{- include "gotenberg.resources" .Values.gotenberg.resources | nindent 12 }}
memory: "{{ .Values.gotenberg.resources.requests.memory }}"
cpu: "{{ .Values.gotenberg.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.gotenberg.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.gotenberg.resources.limits.memory }}"
cpu: "{{ .Values.gotenberg.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.gotenberg.resources.limits.ephemeralStorage }}"
volumes: volumes:
- name: tmp - name: tmp
emptyDir: {} emptyDir: {}
+5 -5
View File
@@ -38,11 +38,11 @@ gotenberg:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeralStorage: 10Mi ephemeralStorage: 10Mi
limits:
cpu: 1
memory: 768Mi
ephemeralStorage: 100Mi
+1 -1
View File
@@ -3,7 +3,7 @@ name: homeassistant
description: A Helm chart to deploy Home Assistant on Kubernetes description: A Helm chart to deploy Home Assistant on Kubernetes
type: application type: application
version: 3.0.0+up2026.2.3 version: 4.0.0+up2026.2.3
appVersion: "2026.2.3" appVersion: "2026.2.3"
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "homeassistant.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "homeassistant.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "homeassistant.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "homeassistant.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "homeassistant.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "homeassistant.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -39,14 +39,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.startupProbe | nindent 12 }} {{- toYaml .Values.startupProbe | nindent 12 }}
resources: resources:
limits: {{- include "homeassistant.resources" .Values.resources | nindent 12 }}
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
ephemeral-storage: {{ .Values.resources.limits.ephemeralStorage }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
ephemeral-storage: {{ .Values.resources.requests.ephemeralStorage }}
volumeMounts: volumeMounts:
- mountPath: /config/configuration.yaml - mountPath: /config/configuration.yaml
subPath: configuration.yaml subPath: configuration.yaml
+8 -8
View File
@@ -43,14 +43,14 @@ securityContext:
- NET_RAW - NET_RAW
resources: resources:
limits: # Limits are optional: memory and ephemeral-storage limits default to
cpu: 1 # limitFactor x the request, an explicitly set limit always wins, and a
memory: 1Gi # CPU limit is only set when configured explicitly under "limits".
ephemeralStorage: 1Gi limitFactor: 3
requests: requests:
cpu: 0.2 cpu: 0.2
memory: 512Mi memory: 512Mi
ephemeralStorage: 128Mi ephemeralStorage: 128Mi
# This is to setup the liveness, readiness and startup probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ # This is to setup the liveness, readiness and startup probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
livenessProbe: livenessProbe:
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v2
name: matrix-synapse name: matrix-synapse
description: A Helm chart to deploy a Matrix Synapse server on Kubernetes description: A Helm chart to deploy a Matrix Synapse server on Kubernetes
type: application type: application
version: 3.0.0+upv1.149.1 version: 4.0.0+upv1.149.1
appVersion: "v1.149.1" appVersion: "v1.149.1"
maintainers: maintainers:
- name: jklein - name: jklein
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "matrix-synapse.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "matrix-synapse.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "matrix-synapse.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "matrix-synapse.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "matrix-synapse.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "matrix-synapse.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -36,14 +36,7 @@ spec:
- name: tmp - name: tmp
mountPath: /tmp mountPath: /tmp
resources: resources:
limits: {{- include "matrix-synapse.resources" .Values.matrix.delegation.resources | nindent 12 }}
memory: "{{ .Values.matrix.delegation.resources.limits.memory }}"
cpu: "{{ .Values.matrix.delegation.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.matrix.delegation.resources.limits.ephemeralStorage }}"
requests:
memory: "{{ .Values.matrix.delegation.resources.requests.memory }}"
cpu: "{{ .Values.matrix.delegation.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.matrix.delegation.resources.requests.ephemeralStorage }}"
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /.well-known/matrix/server path: /.well-known/matrix/server
@@ -65,14 +65,7 @@ spec:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
requests: {{- include "matrix-synapse.resources" .Values.matrix.resources | nindent 12 }}
memory: "{{ .Values.matrix.resources.requests.memory }}"
cpu: "{{ .Values.matrix.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.matrix.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.matrix.resources.limits.memory }}"
cpu: "{{ .Values.matrix.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.matrix.resources.limits.ephemeralStorage }}"
volumeMounts: volumeMounts:
- name: matrix-synapse-volume - name: matrix-synapse-volume
mountPath: /data mountPath: /data
+8 -8
View File
@@ -21,23 +21,23 @@ matrix:
drop: drop:
- ALL - ALL
resources: resources:
limits: # Limits are optional: memory and ephemeral-storage limits default to
memory: "128Mi" # limitFactor x the request, an explicitly set limit always wins, and a
cpu: "250m" # CPU limit is only set when configured explicitly under "limits".
ephemeralStorage: "100Mi" limitFactor: 3
requests: requests:
memory: "64Mi" memory: "64Mi"
cpu: "125m" cpu: "125m"
ephemeralStorage: "50Mi" ephemeralStorage: "50Mi"
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
memory: "1Gi" memory: "1Gi"
cpu: "1" cpu: "1"
ephemeralStorage: "1Gi" ephemeralStorage: "1Gi"
limits:
memory: "2Gi"
cpu: "2"
ephemeralStorage: "2Gi"
storage: storage:
amount: 10Gi amount: 10Gi
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy Outline on Kubernetes
type: application type: application
version: 2.0.0+up1.9.2 version: 3.0.0+up1.9.2
appVersion: 1.9.2 appVersion: 1.9.2
maintainers: maintainers:
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "outline.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "outline.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "outline.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "outline.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "outline.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "outline.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -8
View File
@@ -108,14 +108,7 @@ spec:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
requests: {{- include "outline.resources" .Values.outline.resources | nindent 12 }}
memory: "{{ .Values.outline.resources.requests.memory }}"
cpu: "{{ .Values.outline.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.outline.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.outline.resources.limits.memory }}"
cpu: "{{ .Values.outline.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.outline.resources.limits.ephemeralStorage }}"
volumeMounts: volumeMounts:
- mountPath: "/outline-data/data" - mountPath: "/outline-data/data"
name: outline-data name: outline-data
+4 -4
View File
@@ -11,14 +11,14 @@ outline:
size: 10Gi size: 10Gi
storageClass: null storageClass: null
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeralStorage: 10Mi ephemeralStorage: 10Mi
limits:
cpu: 1
memory: 768Mi
ephemeralStorage: 100Mi
ingress: ingress:
maxUploadFileSize: 25m maxUploadFileSize: 25m
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy Paperless-NGX on Kubernetes
type: application type: application
version: 6.0.0+up2.20.13 version: 7.0.0+up2.20.13
appVersion: 2.20.13 appVersion: 2.20.13
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "paperless-ngx.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "paperless-ngx.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "paperless-ngx.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "paperless-ngx.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "paperless-ngx.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "paperless-ngx.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -30,14 +30,7 @@ spec:
mountPath: "/mnt/consume" mountPath: "/mnt/consume"
readOnly: false readOnly: false
resources: resources:
requests: {{- include "paperless-ngx.resources" .Values.smbConnection.cron.resources | nindent 16 }}
memory: "{{ .Values.smbConnection.cron.resources.requests.memory }}"
cpu: "{{ .Values.smbConnection.cron.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.smbConnection.cron.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.smbConnection.cron.resources.limits.memory }}"
cpu: "{{ .Values.smbConnection.cron.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.smbConnection.cron.resources.limits.ephemeralStorage }}"
restartPolicy: Never restartPolicy: Never
volumes: volumes:
- name: smb-share - name: smb-share
@@ -199,14 +199,7 @@ spec:
- mountPath: /run - mountPath: /run
name: run name: run
resources: resources:
requests: {{- include "paperless-ngx.resources" .Values.paperless.resources | nindent 12 }}
memory: "{{ .Values.paperless.resources.requests.memory }}"
cpu: "{{ .Values.paperless.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.paperless.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.paperless.resources.limits.memory }}"
cpu: "{{ .Values.paperless.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.paperless.resources.limits.ephemeralStorage }}"
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
+8 -8
View File
@@ -34,14 +34,14 @@ paperless:
postConsumptionScripts: [] postConsumptionScripts: []
preConsumptionScripts: [] preConsumptionScripts: []
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.2 cpu: 0.2
memory: 1024Mi memory: 1024Mi
ephemeralStorage: 200Mi ephemeralStorage: 200Mi
limits:
cpu: 1
memory: 2048Mi
ephemeralStorage: 400Mi
# Paperless-ngx supports rootless operation: the pod runs as uid/gid 1000 # Paperless-ngx supports rootless operation: the pod runs as uid/gid 1000
# (the image's default paperless user), fsGroup makes the PVCs writable and # (the image's default paperless user), fsGroup makes the PVCs writable and
# /tmp + /run are emptyDirs so the root filesystem stays read-only. # /tmp + /run are emptyDirs so the root filesystem stays read-only.
@@ -86,14 +86,14 @@ smbConnection:
drop: drop:
- ALL - ALL
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 10m cpu: 10m
memory: 16Mi memory: 16Mi
ephemeralStorage: 10Mi ephemeralStorage: 10Mi
limits:
cpu: 100m
memory: 32Mi
ephemeralStorage: 50Mi
oidc: oidc:
enabled: false enabled: false
autoLoginWithProvider: false autoLoginWithProvider: false
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy Patchmon on Kubernetes
type: application type: application
version: 3.0.0+up1.4.2 version: 4.0.0+up1.4.2
appVersion: "1.4.2" appVersion: "1.4.2"
maintainers: maintainers:
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "patchmon.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "patchmon.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "patchmon.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "patchmon.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "patchmon.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "patchmon.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -159,10 +159,8 @@ spec:
periodSeconds: 10 periodSeconds: 10
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
{{- with .Values.patchmon.backend.resources }}
resources: resources:
{{ toYaml . | nindent 12 }} {{- include "patchmon.resources" .Values.patchmon.backend.resources | nindent 12 }}
{{- end }}
volumeMounts: volumeMounts:
- mountPath: /app/assets - mountPath: /app/assets
name: patchmon-volume name: patchmon-volume
@@ -33,10 +33,8 @@ spec:
value: "{{ .Release.Name }}-{{ .Chart.Name }}-backend-service" value: "{{ .Release.Name }}-{{ .Chart.Name }}-backend-service"
- name: BACKEND_PORT - name: BACKEND_PORT
value: "80" value: "80"
{{- with .Values.patchmon.frontend.resources }}
resources: resources:
{{- toYaml . | nindent 12 }} {{- include "patchmon.resources" .Values.patchmon.frontend.resources | nindent 12 }}
{{- end }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
+8 -8
View File
@@ -22,24 +22,24 @@ patchmon:
drop: drop:
- ALL - ALL
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 128Mi memory: 128Mi
ephemeral-storage: 10Mi ephemeral-storage: 10Mi
limits:
cpu: 0.5
memory: 265Mi
ephemeral-storage: 100Mi
backend: backend:
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeral-storage: 10Mi ephemeral-storage: 10Mi
limits:
cpu: 1
memory: 768Mi
ephemeral-storage: 100Mi
ingress: ingress:
clusterIssuer: null clusterIssuer: null
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy Rallly on Kubernetes
type: application type: application
version: 2.0.0+up4.8.1 version: 3.0.0+up4.8.1
appVersion: "4.8.1" appVersion: "4.8.1"
maintainers: maintainers:
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "rallly.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "rallly.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "rallly.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "rallly.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "rallly.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "rallly.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -1
View File
@@ -131,7 +131,7 @@ spec:
startupProbe: startupProbe:
{{ toYaml .Values.rallly.startupProbe | nindent 12}} {{ toYaml .Values.rallly.startupProbe | nindent 12}}
resources: resources:
{{ toYaml .Values.rallly.resources | nindent 12 }} {{- include "rallly.resources" .Values.rallly.resources | nindent 12 }}
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
readOnlyRootFilesystem: true readOnlyRootFilesystem: true
+4 -4
View File
@@ -15,14 +15,14 @@ rallly:
emailClaimPath: 'email' emailClaimPath: 'email'
nameClaimPath: 'name' nameClaimPath: 'name'
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeral-storage: 100Mi ephemeral-storage: 100Mi
limits:
cpu: 1
memory: 768Mi
ephemeral-storage: 250Mi
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
+1 -1
View File
@@ -4,6 +4,6 @@ description: A Helm chart for Samba
type: application type: application
version: 2.0.0+up4.23.5 version: 3.0.0+up4.23.5
appVersion: 4.23.5 appVersion: 4.23.5
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "samba.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "samba.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "samba.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "samba.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "samba.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "samba.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -8
View File
@@ -46,14 +46,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.samba.startupProbe | nindent 12 }} {{- toYaml .Values.samba.startupProbe | nindent 12 }}
resources: resources:
requests: {{- include "samba.resources" .Values.samba.resources | nindent 12 }}
memory: "{{ .Values.samba.resources.requests.memory }}"
cpu: "{{ .Values.samba.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.samba.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.samba.resources.limits.memory }}"
cpu: "{{ .Values.samba.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.samba.resources.limits.ephemeralStorage }}"
restartPolicy: Always restartPolicy: Always
automountServiceAccountToken: false automountServiceAccountToken: false
securityContext: securityContext:
+4 -4
View File
@@ -28,14 +28,14 @@ samba:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
memory: 50Mi memory: 50Mi
cpu: 0.1 cpu: 0.1
ephemeralStorage: 50Mi ephemeralStorage: 50Mi
limits:
memory: 100Mi
cpu: 1
ephemeralStorage: 100Mi
globalConfig: null globalConfig: null
storageClass: longhorn storageClass: longhorn
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v2
name: satisfactory name: satisfactory
description: A Helm chart to deploy a Satisfactory Gameserver on Kubernetes description: A Helm chart to deploy a Satisfactory Gameserver on Kubernetes
type: application type: application
version: 2.0.0+upv1.9.10 version: 3.0.0+upv1.9.10
appVersion: "v1.9.10" appVersion: "v1.9.10"
maintainers: maintainers:
- name: jklein - name: jklein
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "satisfactory.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "satisfactory.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "satisfactory.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "satisfactory.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "satisfactory.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "satisfactory.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -74,10 +74,8 @@ spec:
periodSeconds: 30 periodSeconds: 30
timeoutSeconds: 10 timeoutSeconds: 10
failureThreshold: 40 failureThreshold: 40
{{- with .Values.server.resources }}
resources: resources:
{{ toYaml . | nindent 12 }} {{- include "satisfactory.resources" .Values.server.resources | nindent 12 }}
{{- end }}
volumeMounts: volumeMounts:
- name: satisfactory-volume - name: satisfactory-volume
mountPath: /config mountPath: /config
+7 -5
View File
@@ -11,11 +11,13 @@ server:
messagingPort: 30888 messagingPort: 30888
storage: 20Gi storage: 20Gi
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
# The game server holds a large world in memory, so the default factor
# stays at 2 to keep the limit at the previously published 8Gi.
limitFactor: 2
requests: requests:
memory: "4Gi" memory: "4Gi"
cpu: "1" cpu: "1"
ephemeral-storage: "5Gi" ephemeral-storage: "5Gi"
limits:
memory: "8Gi"
cpu: "2"
ephemeral-storage: "10Gi"
+1 -1
View File
@@ -4,5 +4,5 @@ description: A Helm chart for deploying a teamspeak-server on Kubernetes
type: application type: application
version: 2.0.0+upv6.0.0.beta8 version: 3.0.0+upv6.0.0.beta8
appVersion: "v6.0.0-beta8" appVersion: "v6.0.0-beta8"
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "teamspeak-server.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "teamspeak-server.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "teamspeak-server.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "teamspeak-server.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "teamspeak-server.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "teamspeak-server.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -57,14 +57,7 @@ spec:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
requests: {{- include "teamspeak-server.resources" .Values.resources | nindent 12 }}
cpu: "0.2"
memory: "100Mi"
ephemeral-storage: "100Mi"
limits:
cpu: "0.5"
memory: "200Mi"
ephemeral-storage: "200Mi"
volumeMounts: volumeMounts:
- name: "teamspeak-volume" - name: "teamspeak-volume"
mountPath: /var/tsserver/ mountPath: /var/tsserver/
+10
View File
@@ -1,3 +1,13 @@
resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests:
cpu: 0.2
memory: 100Mi
ephemeral-storage: 100Mi
storage: storage:
size: 25Gi size: 25Gi
storageClass: longhorn storageClass: longhorn
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "xxx.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "xxx.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "xxx.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "xxx.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "xxx.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "xxx.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -1
View File
@@ -52,7 +52,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.xxx.startupProbe | nindent 12 }} {{- toYaml .Values.xxx.startupProbe | nindent 12 }}
resources: resources:
{{- toYaml .Values.xxx.resources | nindent 12 }} {{- include "xxx.resources" .Values.xxx.resources | nindent 12 }}
securityContext: securityContext:
{{- toYaml .Values.xxx.securityContext.container | nindent 12 }} {{- toYaml .Values.xxx.securityContext.container | nindent 12 }}
restartPolicy: Always restartPolicy: Always
+1 -1
View File
@@ -53,7 +53,7 @@ spec:
startupProbe: startupProbe:
{{- toYaml .Values.xxx.startupProbe | nindent 12 }} {{- toYaml .Values.xxx.startupProbe | nindent 12 }}
resources: resources:
{{- toYaml .Values.xxx.resources | nindent 12 }} {{- include "xxx.resources" .Values.xxx.resources | nindent 12 }}
securityContext: securityContext:
{{- toYaml .Values.xxx.securityContext.container | nindent 12 }} {{- toYaml .Values.xxx.securityContext.container | nindent 12 }}
restartPolicy: Always restartPolicy: Always
+4 -4
View File
@@ -3,14 +3,14 @@ secrets:
xxx: xxx:
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 512Mi memory: 512Mi
ephemeral-storage: 10Mi ephemeral-storage: 10Mi
limits:
cpu: 1
memory: 768Mi
ephemeral-storage: 100Mi
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /
+1 -1
View File
@@ -3,5 +3,5 @@ name: urlaubsverwaltung
description: A Helm chart to deploy urlaubsverwaltung on Kubernetes description: A Helm chart to deploy urlaubsverwaltung on Kubernetes
type: application type: application
version: 3.0.0+up6.5.0 version: 4.0.0+up6.5.0
appVersion: 6.5.0 appVersion: 6.5.0
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "urlaubsverwaltung.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "urlaubsverwaltung.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "urlaubsverwaltung.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "urlaubsverwaltung.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "urlaubsverwaltung.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "urlaubsverwaltung.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -110,14 +110,7 @@ spec:
- name: UV_SECURITY_OIDC_CLAIM-MAPPERS_GROUP-CLAIM_CLAIM-NAME - name: UV_SECURITY_OIDC_CLAIM-MAPPERS_GROUP-CLAIM_CLAIM-NAME
value: "groups" value: "groups"
resources: resources:
requests: {{- include "urlaubsverwaltung.resources" .Values.urlaubsverwaltung.resources | nindent 12 }}
memory: "{{ .Values.urlaubsverwaltung.resources.requests.memory }}"
cpu: "{{ .Values.urlaubsverwaltung.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.urlaubsverwaltung.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.urlaubsverwaltung.resources.limits.memory }}"
cpu: "{{ .Values.urlaubsverwaltung.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.urlaubsverwaltung.resources.limits.ephemeralStorage }}"
readinessProbe: readinessProbe:
httpGet: httpGet:
port: 8080 port: 8080
+4 -4
View File
@@ -23,11 +23,11 @@ urlaubsverwaltung:
drop: drop:
- ALL - ALL
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 768Mi memory: 768Mi
ephemeralStorage: 10Mi
limits:
cpu: 1
memory: 1536Mi
ephemeralStorage: 10Mi ephemeralStorage: 10Mi
+1 -1
View File
@@ -4,7 +4,7 @@ description: A Helm chart to deploy VoucherVault on Kubernetes
type: application type: application
version: 2.0.0+up1.27.4 version: 3.0.0+up1.27.4
appVersion: "1.27.4" appVersion: "1.27.4"
maintainers: maintainers:
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "voucher-vault.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "voucher-vault.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "voucher-vault.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "voucher-vault.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "voucher-vault.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "voucher-vault.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
@@ -59,7 +59,7 @@ spec:
{{- toYaml .Values.voucherVault.startupProbe | nindent 12 }} {{- toYaml .Values.voucherVault.startupProbe | nindent 12 }}
{{- end }} {{- end }}
resources: resources:
{{- toYaml .Values.voucherVault.resources | nindent 12 }} {{- include "voucher-vault.resources" .Values.voucherVault.resources | nindent 12 }}
securityContext: securityContext:
{{- toYaml .Values.voucherVault.securityContext.container | nindent 12 }} {{- toYaml .Values.voucherVault.securityContext.container | nindent 12 }}
volumeMounts: volumeMounts:
+4 -4
View File
@@ -5,14 +5,14 @@ secrets:
voucherVault: voucherVault:
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 256Mi memory: 256Mi
ephemeral-storage: 10Mi ephemeral-storage: 10Mi
limits:
cpu: 1
memory: 384Mi
ephemeral-storage: 100Mi
# "/" answers with a redirect for anonymous users, which httpGet treats as # "/" answers with a redirect for anonymous users, which httpGet treats as
# success. The Host header must be set to 127.0.0.1 because Django's # success. The Host header must be set to 127.0.0.1 because Django's
# ALLOWED_HOSTS only accepts 127.0.0.1 and the configured DOMAIN — probing # ALLOWED_HOSTS only accepts 127.0.0.1 and the configured DOMAIN — probing
+1 -1
View File
@@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 3.0.0+up4.6.4 version: 4.0.0+up4.6.4
# This is the version number of the application being deployed. This version number should be # 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 # incremented each time you make changes to the application. Versions are not expected to
+85
View File
@@ -0,0 +1,85 @@
{{/*
Render the body of a container "resources:" block from a values dict of the form
resources:
limitFactor: 3 # optional, default 3
requests: { cpu, memory, ephemeral-storage / ephemeralStorage, ... }
limits: { ... } # optional, every entry optional
Rules (variant B, see issue #19):
- requests are rendered as given (camelCase "ephemeralStorage" is normalized
to the Kubernetes key "ephemeral-storage").
- an explicitly set limit always wins.
- a missing memory / ephemeral-storage limit is computed as
limitFactor x the corresponding request.
- a missing cpu limit is NOT set at all (the kubelet then treats CPU as
unlimited; CPU is compressible, so this cannot kill the workload).
Usage (the values path to the resources dict varies per chart):
resources:
{{- include "zipline.resources" .Values.<app>.resources | nindent 12 }}
NOTE: charts in this repo deliberately have no dependencies, so this helper 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.resources" -}}
{{- $resources := . | default dict -}}
{{- $factor := 3.0 -}}
{{- if not (kindIs "invalid" $resources.limitFactor) -}}
{{- $factor = float64 $resources.limitFactor -}}
{{- end -}}
{{- $requests := dict -}}
{{- range $key, $value := ($resources.requests | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $requests (include "zipline.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- $limits := dict -}}
{{- range $key, $value := ($resources.limits | default dict) -}}
{{- if not (kindIs "invalid" $value) -}}
{{- $_ := set $limits (include "zipline.resourceKey" $key) $value -}}
{{- end -}}
{{- end -}}
{{- range $key, $request := $requests -}}
{{- if and (ne $key "cpu") (not (hasKey $limits $key)) -}}
{{- $_ := set $limits $key (include "zipline.multiplyQuantity" (dict "quantity" $request "factor" $factor)) -}}
{{- end -}}
{{- end -}}
{{- $out := dict -}}
{{- with $requests }}{{- $_ := set $out "requests" . }}{{- end -}}
{{- with $limits }}{{- $_ := set $out "limits" . }}{{- end -}}
{{- toYaml $out -}}
{{- end -}}
{{/*
Normalize a resource name from values to its Kubernetes key.
*/}}
{{- define "zipline.resourceKey" -}}
{{- if eq . "ephemeralStorage" -}}ephemeral-storage{{- else -}}{{ . }}{{- end -}}
{{- end -}}
{{/*
Multiply a Kubernetes quantity by a factor, keeping its suffix.
Input: dict "quantity" <string|number> "factor" <float64>.
Handles plain numbers ("2", "0.5", 1073741824), decimal ("1.5Gi"), binary
("512Mi", "1Gi", "10Ki") and milli/SI suffixes ("100m", "500M"). Integer
results are printed without a decimal point.
*/}}
{{- define "zipline.multiplyQuantity" -}}
{{- $quantity := printf "%v" .quantity -}}
{{- $number := regexFind "^[0-9]+(\\.[0-9]+)?" $quantity -}}
{{- if not $number -}}
{{- fail (printf "cannot parse resource quantity %q" $quantity) -}}
{{- end -}}
{{- $suffix := trimPrefix $number $quantity -}}
{{- if not (regexMatch "^(m|k|M|G|T|P|E|Ki|Mi|Gi|Ti|Pi|Ei)?$" $suffix) -}}
{{- fail (printf "unsupported resource quantity suffix %q in %q" $suffix $quantity) -}}
{{- end -}}
{{- $product := mulf (float64 $number) .factor -}}
{{- if eq $product (floor $product) -}}
{{- printf "%d%s" (int64 $product) $suffix -}}
{{- else -}}
{{- printf "%v%s" $product $suffix -}}
{{- end -}}
{{- end -}}
+1 -8
View File
@@ -36,14 +36,7 @@ spec:
- name: UPLOADER_ADMIN_LIMIT - name: UPLOADER_ADMIN_LIMIT
value: 500mb value: 500mb
resources: resources:
requests: {{- include "zipline.resources" .Values.zipline.resources | nindent 12 }}
memory: "{{ .Values.zipline.resources.requests.memory }}"
cpu: "{{ .Values.zipline.resources.requests.cpu }}"
ephemeral-storage: "{{ .Values.zipline.resources.requests.ephemeralStorage }}"
limits:
memory: "{{ .Values.zipline.resources.limits.memory }}"
cpu: "{{ .Values.zipline.resources.limits.cpu }}"
ephemeral-storage: "{{ .Values.zipline.resources.limits.ephemeralStorage }}"
ports: ports:
- name: "zipline-server" - name: "zipline-server"
containerPort: 3000 containerPort: 3000
+5 -5
View File
@@ -51,11 +51,11 @@ zipline:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 30 failureThreshold: 30
resources: resources:
# Limits are optional: memory and ephemeral-storage limits default to
# limitFactor x the request, an explicitly set limit always wins, and a
# CPU limit is only set when configured explicitly under "limits".
limitFactor: 3
requests: requests:
cpu: 0.1 cpu: 0.1
memory: 265Mi memory: 265Mi
ephemeralStorage: 100Mi ephemeralStorage: 100Mi
limits:
cpu: 1
memory: 768Mi
ephemeralStorage: 200Mi