- Create infrastructure for PostgreSQL StatefulSet in Kubernetes - Implement environment-specific configurations (staging/production) - Add Kustomize overlays for deterministic deployments - Document deployment process in AGENTS.md and infra/k8s/README.md - Include Makefile and helper scripts for easy management New directories: - infra/k8s/base/ - Shared resources (StatefulSet, Service, PVC, Namespace) - infra/k8s/staging/ - Staging environment overlay - infra/k8s/production/ - Production environment overlay Key files: - infra/k8s/base/kustomization.yaml - infra/k8s/staging/kustomization.yaml - infra/k8s/production/kustomization.yaml - infra/k8s/README.md Resources are prefixed by environment (staging-, production-) and deployed to the postgres namespace.
18 lines
551 B
Bash
Executable File
18 lines
551 B
Bash
Executable File
#!/bin/bash
|
|
# Wrapper script for applying kustomize with environment variable substitution
|
|
|
|
set -e
|
|
|
|
# Use ENVIRONMENT from environment or default to 'staging'
|
|
ENVIRONMENT="${ENVIRONMENT:-staging}"
|
|
export ENVIRONMENT
|
|
|
|
# Set POSTGRES_DB if not set
|
|
POSTGRES_DB="${POSTGRES_DB:-hapi_${ENVIRONMENT}}"
|
|
export POSTGRES_DB
|
|
|
|
# Run kubectl apply with environment variables substituted
|
|
envsubst '${ENVIRONMENT} ${POSTGRES_DB}' < kustomization.yaml > kustomization.subst.yaml
|
|
kubectl apply -f kustomization.subst.yaml --dry-run=client
|
|
rm kustomization.subst.yaml
|