feat: Add container registry support and Kustomize foundation

- Add registry secret template for private container registry authentication
- Fix frontend deployment to use imagePullSecrets for private registry
- Enhance deploy-k8s.sh with registry authentication handling
- Add PVC storage size validation to prevent storage reduction errors
- Add graceful StatefulSet update error handling
- Fix template variable substitution for DOCKER_IMAGE
- Remove conflicting static PVC file that had unprocessed template variables
- Add Kustomize structure as alternative to shell script templates:
  - Base configuration with common resources
  - Development overlay with dev-specific configurations
  - Support for environment-specific image tags and resource limits

Registry setup requires setting REGISTRY_USERNAME, REGISTRY_PASSWORD, and
optionally REGISTRY_HOST in .env file for private registry authentication.
This commit is contained in:
William Valentin
2025-09-07 20:28:23 -07:00
parent 2913f879ca
commit e47150f80a
7 changed files with 296 additions and 17 deletions

View File

@@ -0,0 +1,83 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
metadata:
name: rxminder-dev
namespace: rxminder-dev
resources:
- ../../base
# Development-specific labels
commonLabels:
environment: dev
# Override images for development
images:
- name: frontend-image
newName: gitea-http.taildb3494.ts.net/will/rxminder
newTag: dev
- name: couchdb-image
newName: couchdb
newTag: 3.3.2
# Development replicas (lower for resource conservation)
replicas:
- name: rxminder-frontend
count: 1
# Development-specific patches
patches:
- target:
kind: Deployment
name: rxminder-frontend
patch: |-
- op: replace
path: /spec/template/spec/containers/0/resources/requests/memory
value: "16Mi"
- op: replace
path: /spec/template/spec/containers/0/resources/limits/memory
value: "32Mi"
- op: add
path: /spec/template/spec/containers/0/env
value:
- name: NODE_ENV
value: "development"
- name: LOG_LEVEL
value: "debug"
- target:
kind: Ingress
name: rxminder-ingress
patch: |-
- op: replace
path: /spec/rules/0/host
value: "rxminder-dev.local"
- target:
kind: PersistentVolumeClaim
name: rxminder-couchdb-pvc
patch: |-
- op: replace
path: /spec/resources/requests/storage
value: "1Gi"
# Development-specific ConfigMap
configMapGenerator:
- name: rxminder-config
literals:
- NODE_ENV=development
- API_URL=http://rxminder-couchdb-service:5984
- LOG_LEVEL=debug
- DEBUG=true
behavior: replace
# Development secrets (use weak passwords for dev)
secretGenerator:
- name: couchdb-secret
literals:
- username=admin
- password=devpass123
type: Opaque
behavior: replace