From 11143ff1dc956c61e4bb9eb2155c25acbf5b22f4 Mon Sep 17 00:00:00 2001 From: Ramesh Nethi Date: Mon, 11 May 2026 20:57:26 +0530 Subject: [PATCH] refactor: optimize PGDATA logic and repair changelog --- CHANGELOG.md | 6 ++++++ helm/optio/Chart.yaml | 4 ++-- helm/optio/templates/NOTES.txt | 19 +++++++++++++++++++ helm/optio/templates/postgres.yaml | 12 ++++++++---- helm/optio/values.yaml | 6 ++++++ 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0e1afc6..80fdaabf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- **Helm (Chart 0.1.1): PostgreSQL 18 enablement** — new `postgresql.usePgdataSubdirectory` value (default `false`) allows opt-in use of a `pgdata` subdirectory on the PVC. This pattern is required for fresh PostgreSQL 18+ deployments to avoid PVC metadata conflicts (lost+found). **BREAKING if enabled on existing deployments** — see chart NOTES.txt for migration instructions. + ## [0.4.0] - 2026-04-27 ### Added diff --git a/helm/optio/Chart.yaml b/helm/optio/Chart.yaml index 318ed306..3a2738e2 100644 --- a/helm/optio/Chart.yaml +++ b/helm/optio/Chart.yaml @@ -3,8 +3,8 @@ name: optio description: AI Agent Workflow Orchestration kubeVersion: ">=1.33.0-0" type: application -version: 0.1.0 -appVersion: "0.1.0" +version: 0.1.1 +appVersion: "0.4.0" home: https://github.com/jonwiggins/optio sources: - https://github.com/jonwiggins/optio diff --git a/helm/optio/templates/NOTES.txt b/helm/optio/templates/NOTES.txt index 2ef832aa..69f2c039 100644 --- a/helm/optio/templates/NOTES.txt +++ b/helm/optio/templates/NOTES.txt @@ -60,3 +60,22 @@ For Docker Desktop / kind / minikube, also patch with --kubelet-insecure-tls: -p '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]' Without metrics-server, CPU and memory usage will show as "N/A". + +{{- if and .Values.postgresql.enabled (not .Values.postgresql.usePgdataSubdirectory) }} + +--- + +POSTGRESQL DATA DIRECTORY + +PostgreSQL is using the PVC mount root as the data directory. + +For PostgreSQL 18+ or to avoid conflicts with PVC metadata (lost+found), +consider enabling the subdirectory pattern in values.yaml: + + postgresql: + usePgdataSubdirectory: true + +⚠️ WARNING: This is a BREAKING CHANGE for existing deployments. +Enabling this on an existing database will cause data loss unless you +manually migrate first. See CHANGELOG for migration instructions. +{{- end }} diff --git a/helm/optio/templates/postgres.yaml b/helm/optio/templates/postgres.yaml index 6c313e6d..0d59b79c 100644 --- a/helm/optio/templates/postgres.yaml +++ b/helm/optio/templates/postgres.yaml @@ -73,9 +73,13 @@ spec: command: ['sh', '-c'] args: - | - mkdir -p /var/lib/postgresql/data/pgdata chown -R 999:999 /var/lib/postgresql/data + chmod 700 /var/lib/postgresql/data + {{- if .Values.postgresql.usePgdataSubdirectory }} + mkdir -p /var/lib/postgresql/data/pgdata chmod 700 /var/lib/postgresql/data/pgdata + chown 999:999 /var/lib/postgresql/data/pgdata + {{- end }} volumeMounts: - name: data mountPath: /var/lib/postgresql/data @@ -137,10 +141,10 @@ spec: secretKeyRef: name: {{ .Release.Name }}-postgres-credentials key: POSTGRES_PASSWORD - # Use a subdirectory for PGDATA so initdb doesn't trip over - # filesystem artifacts (e.g. lost+found on ext4 PVs). + # Use a subdirectory for PGDATA if enabled (recommended for PG 18+) + # to avoid filesystem artifacts (e.g. lost+found on ext4 PVs). - name: PGDATA - value: /var/lib/postgresql/data/pgdata + value: {{ if .Values.postgresql.usePgdataSubdirectory }}/var/lib/postgresql/data/pgdata{{ else }}/var/lib/postgresql/data{{ end }} ports: - containerPort: 5432 volumeMounts: diff --git a/helm/optio/values.yaml b/helm/optio/values.yaml index 5b4cacd2..befbe462 100644 --- a/helm/optio/values.yaml +++ b/helm/optio/values.yaml @@ -215,6 +215,12 @@ postgresql: image: repository: postgres tag: "16" + # Use PGDATA subdirectory pattern (recommended for PostgreSQL 18+). + # When true, creates /var/lib/postgresql/data/pgdata subdirectory to avoid + # conflicts with PVC metadata (lost+found). Required for fresh PostgreSQL 18+ + # deployments. BREAKING: Defaults to false for existing deployments to preserve data. + # Set to true for new installs or after manual migration (see chart NOTES). + usePgdataSubdirectory: false resources: requests: cpu: 100m