diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 425bd89..b85b350 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -30,6 +30,26 @@ shouldn't blow up the rendered chart). {{- toYaml (index $cfg .role) -}} {{- 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 .Values.postgres.password if set; otherwise generates a 32-char