homek8s/apps/base/customer1/odoo.yaml
Lance Walters ae22aab330 apps(customer1): anonymize client name — farrisilk -> customer1
Rename the client-shaped lab replica namespace and its manifests to keep the
client name out of the repo going forward (git history is intentionally not
rewritten).

- apps/base/farrisilk -> apps/base/customer1 (namespace, workloads, PVCs,
  HTTPRoutes, backup CronJob, README)
- infrastructure/networking/internal/gateway-farrisilk-{odoo,metabase}.yaml ->
  gateway-customer1-{odoo,metabase}.yaml (listener ports unchanged: 8086/8087)
- firewall comment headers updated (rules/ports untouched)

No functional change beyond object names; workloads remain parked at 0.
2026-11-24 01:46:25 -05:00

261 lines
8.4 KiB
YAML

# Odoo 18 — the application half of the Customer 1 lab replica.
#
# Image is pinned to the DATED build, never `18.0`/`latest`: Odoo auto-migrates
# its database schema on start, so a floating tag turns a pod restart into an
# unplanned upgrade of a database you may be auditing.
#
# This image already ships wkhtmltopdf 0.12.6.1 (patched Qt) at
# /usr/local/bin/wkhtmltopdf, so PDF reports/ invoices render without a derived
# image. Verified 2026-11-22 — see README.
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: odoo-data
namespace: customer1
spec:
accessModes: [ReadWriteOnce]
storageClassName: local-path
resources:
requests:
storage: 10Gi
---
# Empty by default. This is where the client's custom modules are copied in
# (`kubectl cp ./module customer1/<odoo-pod>:/mnt/extra-addons/...`), which is
# why it is a PVC and not an emptyDir: a module installed from here must survive
# a pod restart, or the modules table and the addons path disagree and Odoo
# refuses to start the affected modules.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: odoo-extra-addons
namespace: customer1
spec:
accessModes: [ReadWriteOnce]
storageClassName: local-path
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: odoo
namespace: customer1
spec:
# Parked 2026-11-22: siriussec's 15 W adapter cannot carry this replica
# stack (Odoo + two JVM/Postgres processes) alongside the public gateway
# workloads. Set back to 1 to bring the client replica up; PVCs are kept.
replicas: 0
strategy:
type: Recreate
selector:
matchLabels:
app: odoo
template:
metadata:
labels:
app: odoo
app.kubernetes.io/part-of: customer1
spec:
# Envoy has to reach the backend on the same node it serves from, and the
# filestore PVC is local-path (siriussec-only anyway).
nodeSelector:
kubernetes.io/hostname: siriussec
tolerations:
- key: dedicated
operator: Exists
effect: PreferNoSchedule
initContainers:
# Odoo has no env-var support for db_password, so the config file is
# rendered from the ConfigMap template + the Secret on every pod start
# into an emptyDir. Runs as root only to fix PVC ownership (the image
# user is uid 100 / gid 101 and local-path hands out root-owned dirs).
- name: render-config
image: odoo:18.0-20261112
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0
command:
- /bin/sh
- -ec
- |
mkdir -p /mnt/extra-addons /var/lib/odoo /etc/odoo-runtime
chown -R 100:101 /var/lib/odoo /mnt/extra-addons
chmod 0755 /mnt/extra-addons
umask 077
cat > /etc/odoo-runtime/odoo.conf <<EOF
[options]
admin_passwd = ${ODOO_ADMIN_PASSWD}
addons_path = /mnt/extra-addons,/mnt/enterprise-addons,/usr/lib/python3/dist-packages/odoo/addons
data_dir = /var/lib/odoo
db_host = ${DB_HOST}
db_port = ${DB_PORT}
db_name = odoo
db_user = odoo
db_password = ${ODOO_DB_PASSWORD}
dbfilter = ^odoo\$
list_db = False
proxy_mode = True
workers = 0
limit_memory_hard = 1610612736
limit_memory_soft = 1342177280
max_cron_threads = 1
log_level = info
log_handler = :INFO
xmlrpc_port = 8069
EOF
chown 100:101 /etc/odoo-runtime/odoo.conf
env:
- name: DB_HOST
value: pg
- name: DB_PORT
value: "5432"
- name: ODOO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: pg-users
key: odoo_password
- name: ODOO_ADMIN_PASSWD
valueFrom:
secretKeyRef:
name: odoo-config
key: admin_passwd
volumeMounts:
- name: runtime-config
mountPath: /etc/odoo-runtime
- name: data
mountPath: /var/lib/odoo
- name: extra-addons
mountPath: /mnt/extra-addons
# "Init once". Idempotent: reinstalls nothing when the database already
# has tables, but always re-applies the BI grants/revokes and the admin
# credentials. Script lives in ConfigMap odoo-init.
- name: init-db
image: odoo:18.0-20261112
imagePullPolicy: IfNotPresent
command: ["python3", "/opt/init/init_db.py"]
env:
- name: DB_HOST
value: pg
- name: DB_PORT
value: "5432"
- name: ODOO_DB_NAME
value: odoo
- name: PG_SUPERUSER
valueFrom:
secretKeyRef:
name: pg-app
key: username
- name: PG_SUPERPASS
valueFrom:
secretKeyRef:
name: pg-app
key: password
- name: ODOO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: pg-users
key: odoo_password
- name: ODOO_ADMIN_LOGIN
valueFrom:
secretKeyRef:
name: odoo-admin
key: email
- name: ODOO_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: odoo-admin
key: password
- name: TZ
value: America/Los_Angeles
volumeMounts:
- name: runtime-config
mountPath: /etc/odoo-runtime
- name: data
mountPath: /var/lib/odoo
- name: extra-addons
mountPath: /mnt/extra-addons
- name: enterprise-addons
mountPath: /mnt/enterprise-addons
- name: init-script
mountPath: /opt/init
containers:
- name: odoo
image: odoo:18.0-20261112
imagePullPolicy: IfNotPresent
command: ["odoo"]
args: ["-c", "/etc/odoo-runtime/odoo.conf"]
ports:
- name: http
containerPort: 8069
env:
- name: TZ
value: America/Los_Angeles
- name: HOST
value: 0.0.0.0
readinessProbe:
httpGet:
path: /web/login
port: http
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 90
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 4
resources:
requests:
cpu: 200m
memory: 512Mi
# workers=0 is a single process; the config's limit_memory_hard is
# 1.5 GiB, below this container limit, so Odoo throttles itself
# before the kernel OOM-kills the pod.
limits:
memory: 2Gi
volumeMounts:
- name: runtime-config
mountPath: /etc/odoo-runtime
- name: data
mountPath: /var/lib/odoo
- name: extra-addons
mountPath: /mnt/extra-addons
- name: enterprise-addons
mountPath: /mnt/enterprise-addons
volumes:
- name: runtime-config
emptyDir: {}
- name: data
persistentVolumeClaim:
claimName: odoo-data
- name: extra-addons
persistentVolumeClaim:
claimName: odoo-extra-addons
# Empty, unused until the Enterprise licence question is answered. It
# exists so /mnt/enterprise-addons is already on addons_path the day an
# EE addons tree is dropped in, without a manifest change.
- name: enterprise-addons
emptyDir: {}
- name: init-script
configMap:
name: odoo-init
---
apiVersion: v1
kind: Service
metadata:
name: odoo
namespace: customer1
spec:
type: ClusterIP
selector:
app: odoo
ports:
- name: http
port: 8069
targetPort: http
protocol: TCP