feat: Add PostgreSQL Kubernetes deployment with Kustomize
- 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.
This commit is contained in:
1 parent
9568d4ca6e
commit
88235fc824
26 files changed
+1407
-14
No files matched your search
@@ -11,9 +11,10 @@ This implementation creates the Linode infrastructure for the HAPI project using
|
||||
| Module | Location | Description |
|
||||
|--------|----------|-------------|
|
||||
| **Backend** | `infra/backend/` | Terraform state stored in Linode Object Storage |
|
||||
| **Kubernetes** | `infra/k8s/` | PostgreSQL StatefulSet with persistent storage |
|
||||
| **Network** | `infra/network/` | Firewall rules for API, PostgreSQL, and Adminer |
|
||||
| **PostgreSQL** | `infra/postgres/` | Database instances for staging and production |
|
||||
| **Storage** | `infra/storage/` | Object Storage buckets for uploads and state |
|
||||
| **Network** | `infra/network/` | Firewall rules for API, PostgreSQL, and Adminer |
|
||||
|
||||
### Directory Structure
|
||||
|
||||
@@ -23,6 +24,17 @@ infra/
|
||||
│ ├── main.tf
|
||||
│ ├── variables.tf
|
||||
│ └── terraform.tfvars.example
|
||||
├── k8s/ # PostgreSQL Kubernetes manifests
|
||||
│ ├── kustomization.yaml
|
||||
│ ├── Makefile
|
||||
│ ├── pvc.yaml
|
||||
│ ├── README.md
|
||||
│ ├── service.yaml
|
||||
│ └── statefulset.yaml
|
||||
├── network/ # Firewall configuration
|
||||
│ ├── main.tf
|
||||
│ ├── variables.tf
|
||||
│ └── terraform.tfvars.example
|
||||
├── postgres/ # PostgreSQL database instances
|
||||
│ ├── main.tf
|
||||
│ ├── variables.tf
|
||||
@@ -32,10 +44,6 @@ infra/
|
||||
│ ├── main.tf
|
||||
│ ├── variables.tf
|
||||
│ └── terraform.tfvars.example
|
||||
├── network/ # Firewall configuration
|
||||
│ ├── main.tf
|
||||
│ ├── variables.tf
|
||||
│ └── terraform.tfvars.example
|
||||
├── main.tf # Orchestration file
|
||||
├── providers.tf # Provider configurations
|
||||
├── variables.tf # Common variables
|
||||
@@ -43,7 +51,8 @@ infra/
|
||||
├── .gitignore # Terraform ignores
|
||||
├── .env.example # Environment variable template
|
||||
├── Makefile # Common commands
|
||||
└── README.md # Infrastructure documentation
|
||||
├── README.md # Infrastructure documentation
|
||||
└── IMPLEMENTATION-SUMMARY.md # This file
|
||||
```
|
||||
|
||||
## Implementation Details
|
||||
@@ -60,7 +69,19 @@ infra/
|
||||
- Separate database names (`hapi_staging`, `hapi_production`)
|
||||
- Random password generation for database access
|
||||
|
||||
### 3. Object Storage (`infra/storage/`)
|
||||
### 2.5. Kubernetes (`infra/k8s/`) (New)
|
||||
- PostgreSQL StatefulSet with 50Gi persistent storage
|
||||
- ClusterIP Service for internal access
|
||||
- Kustomize for environment-specific customization
|
||||
- Health checks and resource limits configured
|
||||
|
||||
### 4. Kubernetes (`infra/k8s/`) (New)
|
||||
- PostgreSQL StatefulSet with 50Gi persistent storage
|
||||
- ClusterIP Service for internal access
|
||||
- Kustomize for environment-specific customization
|
||||
- Health checks and resource limits configured
|
||||
|
||||
### 5. Object Storage (`infra/storage/`)
|
||||
- Upload buckets for staging and production
|
||||
- Terraform state buckets for each environment
|
||||
- S3-compatible API configuration
|
||||
|
||||
Reference in new issue
Block a user