chart: instance.storage helper resolves override > tier > default

This commit is contained in:
2026-04-27 17:16:51 +00:00
parent 00c9be8fdf
commit caa58738b7

View File

@@ -30,6 +30,26 @@ shouldn't blow up the rendered chart).
{{- toYaml (index $cfg .role) -}} {{- toYaml (index $cfg .role) -}}
{{- end -}} {{- end -}}
{{/*
Storage size for a given layer (`filestore` | `database`). Resolution
order, most-specific first:
1. instance.{layer}Storage in the tenant overlay (operator override)
2. sizes[size].storage.{layer} (per-tier default)
3. legacy chart-level fallback (.Values.odoo.filestoreSize / .Values.postgres.storage)
This lets operators decouple storage from CPU/RAM tiers — a Small
instance with lots of attachments can have 50 GB filestore without
upgrading to Medium for capacity it doesn't need.
*/}}
{{- define "instance.storage" -}}
{{- $size := .Values.instance.size | default "small" -}}
{{- $tier := index .Values.sizes $size | default (index .Values.sizes "small") -}}
{{- if eq .layer "filestore" -}}
{{- if .Values.instance.filestoreStorage -}}{{ .Values.instance.filestoreStorage }}{{- else if and $tier.storage $tier.storage.filestore -}}{{ $tier.storage.filestore }}{{- else -}}{{ .Values.odoo.filestoreSize | default "10Gi" }}{{- end -}}
{{- else if eq .layer "database" -}}
{{- if .Values.instance.dbStorage -}}{{ .Values.instance.dbStorage }}{{- else if and $tier.storage $tier.storage.database -}}{{ $tier.storage.database }}{{- else -}}{{ .Values.postgres.storage | default "10Gi" }}{{- end -}}
{{- end -}}
{{- end -}}
{{/* {{/*
Postgres password. Looks up the existing Secret on upgrades; uses Postgres password. Looks up the existing Secret on upgrades; uses
.Values.postgres.password if set; otherwise generates a 32-char .Values.postgres.password if set; otherwise generates a 32-char