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 odoosky.io/component: instance
{{- end -}} {{- 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 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

View File

@@ -47,7 +47,7 @@ spec:
- name: filestore - name: filestore
mountPath: /var/lib/odoo mountPath: /var/lib/odoo
resources: 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 # /web/login is the most stable health endpoint across Odoo
# 16/17/18/19 — /web/health is 17+. Use login HTTP 200 as # 16/17/18/19 — /web/health is 17+. Use login HTTP 200 as
# readiness signal. # readiness signal.

View File

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

View File

@@ -12,19 +12,56 @@ instance:
# The full HTTPS hostname this instance answers on. # The full HTTPS hostname this instance answers on.
# Tenants live under *.tenants.odoosky.org (covered by wildcard DNS A). # Tenants live under *.tenants.odoosky.org (covered by wildcard DNS A).
domain: demo.tenants.odoosky.org domain: demo.tenants.odoosky.org
# Named size — looked up against the `sizes` table below to derive
# CPU / memory limits + Odoo workers. Per-tenant overlays only need
# `instance.size: medium` (etc); they don't have to know the numbers.
size: small
# The named-size table. Single source of truth for what each instance
# tier actually gets. Adjust here, ALL future instances pick up the
# new defaults on next reconcile. Existing instances keep their
# previously-rendered manifests until ArgoCD re-syncs.
#
# Anchored loosely on v2's tested defaults:
# tiny — dev/preview, 1 user
# small — 515 users, default
# medium — 1550 users
# large — 50150 users
sizes:
tiny:
odoo:
requests: { memory: 256Mi, cpu: 100m }
limits: { memory: 1Gi, cpu: "1" }
postgres:
requests: { memory: 128Mi, cpu: 50m }
limits: { memory: 256Mi, cpu: 500m }
small:
odoo:
requests: { memory: 512Mi, cpu: 250m }
limits: { memory: 2Gi, cpu: "2" }
postgres:
requests: { memory: 256Mi, cpu: 100m }
limits: { memory: 1Gi, cpu: "1" }
medium:
odoo:
requests: { memory: 1Gi, cpu: 500m }
limits: { memory: 4Gi, cpu: "4" }
postgres:
requests: { memory: 512Mi, cpu: 250m }
limits: { memory: 2Gi, cpu: "2" }
large:
odoo:
requests: { memory: 2Gi, cpu: "1" }
limits: { memory: 8Gi, cpu: "6" }
postgres:
requests: { memory: 1Gi, cpu: 500m }
limits: { memory: 4Gi, cpu: "3" }
odoo: odoo:
image: odoo image: odoo
tag: "18.0" tag: "18.0"
# Filestore PVC size (Odoo's /var/lib/odoo). # Filestore PVC size (Odoo's /var/lib/odoo).
filestoreSize: 10Gi filestoreSize: 10Gi
resources:
requests:
memory: 512Mi
cpu: 250m
limits:
memory: 2Gi
cpu: "2"
postgres: postgres:
image: postgres image: postgres
@@ -35,13 +72,6 @@ postgres:
# the existing Secret on subsequent upgrades (lookup pattern). # the existing Secret on subsequent upgrades (lookup pattern).
password: "" password: ""
storage: 10Gi storage: 10Gi
resources:
requests:
memory: 256Mi
cpu: 100m
limits:
memory: 1Gi
cpu: "1"
ingress: ingress:
# Traefik entrypoint name (set on the Traefik install in the # Traefik entrypoint name (set on the Traefik install in the