Add named sizes table (tiny/small/medium/large)

This commit is contained in:
git_admin
2026-04-26 20:04:39 +03:00
parent a915b31588
commit 97666c4e2f
4 changed files with 58 additions and 16 deletions

View File

@@ -18,6 +18,18 @@ app.kubernetes.io/version: {{ .Values.odoo.tag | quote }}
odoosky.io/component: instance
{{- end -}}
{{/*
Resources for a given role (`odoo` | `postgres`), looked up against
the `sizes` table by `instance.size`. Falls back to "small" if the
operator picked a name that doesn't exist (defensive: a typo
shouldn't blow up the rendered chart).
*/}}
{{- define "instance.resources" -}}
{{- $size := .Values.instance.size | default "small" -}}
{{- $cfg := index .Values.sizes $size | default (index .Values.sizes "small") -}}
{{- toYaml (index $cfg .role) -}}
{{- end -}}
{{/*
Postgres password. Looks up the existing Secret on upgrades; uses
.Values.postgres.password if set; otherwise generates a 32-char

View File

@@ -47,7 +47,7 @@ spec:
- name: filestore
mountPath: /var/lib/odoo
resources:
{{- toYaml .Values.odoo.resources | nindent 12 }}
{{- include "instance.resources" (dict "Values" .Values "role" "odoo") | nindent 12 }}
# /web/login is the most stable health endpoint across Odoo
# 16/17/18/19 — /web/health is 17+. Use login HTTP 200 as
# readiness signal.

View File

@@ -37,7 +37,7 @@ spec:
- name: pgdata
mountPath: /var/lib/postgresql/data
resources:
{{- toYaml .Values.postgres.resources | nindent 12 }}
{{- include "instance.resources" (dict "Values" .Values "role" "postgres") | nindent 12 }}
readinessProbe:
exec:
command: ["sh", "-c", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]