247 lines
6.3 KiB
Markdown
247 lines
6.3 KiB
Markdown
# Poimen Memory — ArgoCD Tracking & Deployment
|
|
|
|
## Status
|
|
|
|
✅ **Poimen Memory is tracked in homelab ArgoCD**
|
|
✅ **All config files in place**
|
|
✅ **Ready to deploy on next homelab sync**
|
|
|
|
---
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Homelab ArgoCD Root
|
|
↓ (wave 7)
|
|
71-poimen-memory.yaml (homelab repo)
|
|
↓ syncs k8s/argocd/ from Poimen Memory repo
|
|
Poimen Memory k8s/argocd/
|
|
├── kustomization.yaml
|
|
└── memory-database-app.yaml
|
|
↓ syncs k8s/infra/databases/
|
|
Memory CNPG Cluster (wave 2 within Poimen Memory)
|
|
```
|
|
|
|
---
|
|
|
|
## Configuration Files
|
|
|
|
### 1. Homelab Repository
|
|
**Location:** `/Users/rockliang/workplace/homelab/k8s/argocd/`
|
|
|
|
**File 1: `projects/homelab-project.yaml` (UPDATED)**
|
|
```yaml
|
|
sourceRepos:
|
|
- https://github.com/Riotpiaole/riotpiao.homelab.com.git
|
|
- https://github.com/Riotpiaole/Poimen-memory.git # ← ADDED
|
|
- https://forgejo.riotpiao.com/rock/*
|
|
# ... public Helm repos
|
|
```
|
|
**What it does:** Authorizes ArgoCD to sync from Poimen Memory repo
|
|
|
|
**File 2: `apps/71-poimen-memory.yaml` (NEW)**
|
|
```yaml
|
|
apiVersion: argoproj.io/v1alpha1
|
|
kind: Application
|
|
metadata:
|
|
name: poimen-memory-root
|
|
annotations:
|
|
argocd.argoproj.io/sync-wave: "7"
|
|
spec:
|
|
project: homelab
|
|
source:
|
|
repoURL: https://github.com/Riotpiaole/Poimen-memory.git
|
|
path: k8s/argocd
|
|
destination:
|
|
server: https://kubernetes.default.svc
|
|
```
|
|
**What it does:** Root application that syncs the Poimen Memory app-of-apps
|
|
|
|
### 2. Poimen Memory Repository
|
|
**Location:** `/Users/rockliang/workplace/Poimen/memory/k8s/argocd/`
|
|
|
|
**File 1: `kustomization.yaml` (NEW)**
|
|
```yaml
|
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
kind: Kustomization
|
|
resources:
|
|
- memory-database-app.yaml
|
|
```
|
|
**What it does:** Declares the application manifests for Poimen Memory
|
|
|
|
**File 2: `memory-database-app.yaml` (NEW)**
|
|
```yaml
|
|
apiVersion: argoproj.io/v1alpha1
|
|
kind: Application
|
|
metadata:
|
|
name: poimen-memory-database
|
|
annotations:
|
|
argocd.argoproj.io/sync-wave: "2" # Wave 2 = databases
|
|
spec:
|
|
project: homelab
|
|
source:
|
|
repoURL: https://github.com/Riotpiaole/Poimen-memory.git
|
|
path: k8s/infra/databases
|
|
destination:
|
|
server: https://kubernetes.default.svc
|
|
```
|
|
**What it does:** Syncs the CNPG Postgres cluster config from `k8s/infra/databases/`
|
|
|
|
---
|
|
|
|
## Deployment Wave Order
|
|
|
|
```
|
|
Wave 0: Homelab Root (homelab-root.yaml)
|
|
↓
|
|
Wave 2: Databases (k8s/infra/databases/)
|
|
├── 40-data.yaml (homelab databases)
|
|
│ ├── authentik-db
|
|
│ ├── temporal-db
|
|
│ └── memory-db (from k8s/infra/databases/kustomization.yaml)
|
|
└── 71-poimen-memory.yaml syncs its own wave 2 (memory-database-app)
|
|
↓
|
|
Wave 7: Applications
|
|
├── Poimen Memory Root (poimen-memory-root)
|
|
├── Poimen Services (future)
|
|
└── Other applications
|
|
```
|
|
|
|
---
|
|
|
|
## Deployment Checklist
|
|
|
|
### Prerequisites
|
|
- [ ] Poimen Memory repo exists on GitHub at `Riotpiaole/Poimen-memory`
|
|
- [ ] Main branch is up-to-date with:
|
|
- [ ] `k8s/infra/databases/memory-db.yaml`
|
|
- [ ] `k8s/infra/databases/kustomization.yaml`
|
|
- [ ] `k8s/argocd/memory-database-app.yaml`
|
|
- [ ] `k8s/argocd/kustomization.yaml`
|
|
|
|
### Homelab Sync
|
|
- [ ] Push homelab changes:
|
|
```bash
|
|
cd ~/workplace/homelab
|
|
git add k8s/argocd/projects/homelab-project.yaml
|
|
git add k8s/argocd/apps/71-poimen-memory.yaml
|
|
git commit -m "feat: add Poimen Memory to ArgoCD tracking (M2.2)"
|
|
git push
|
|
```
|
|
- [ ] Trigger homelab sync (ArgoCD UI or CLI)
|
|
```bash
|
|
argocd app sync homelab-root
|
|
```
|
|
- [ ] Verify wave 7 (Poimen Memory Root app appears)
|
|
|
|
### Deployment
|
|
- [ ] Wait for wave 2 (databases sync)
|
|
```bash
|
|
kubectl get app -n argocd | grep poimen-memory
|
|
# Should show: poimen-memory-root, poimen-memory-database
|
|
```
|
|
- [ ] Verify cluster health
|
|
```bash
|
|
kubectl get clusters -n poimen
|
|
# NAME PHASE INSTANCES
|
|
# memory-db Healthy 3/3
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### App not appearing in ArgoCD
|
|
```bash
|
|
# Check if homelab-root synced the new app
|
|
argocd app get homelab-root
|
|
# Look for poimen-memory-root in the "Application Details"
|
|
|
|
# Check AppProject allows the repo
|
|
kubectl get appproject homelab -n argocd -o yaml | grep -A5 sourceRepos
|
|
# Should include: https://github.com/Riotpiaole/Poimen-memory.git
|
|
```
|
|
|
|
### Cluster not deploying
|
|
```bash
|
|
# Check app sync status
|
|
argocd app get poimen-memory-root
|
|
# Look for sync status and any error messages
|
|
|
|
# Check kustomize
|
|
kubectl kustomize /Users/rockliang/workplace/Poimen/memory/k8s/infra/databases/
|
|
# Should output memory-db Namespace + Cluster CR
|
|
|
|
# Check CNPG operator
|
|
kubectl get crds | grep postgresql
|
|
# Should show postgresql.cnpg.io
|
|
```
|
|
|
|
### CNPG cluster pending
|
|
```bash
|
|
# Check cluster status
|
|
kubectl describe cluster memory-db -n poimen
|
|
|
|
# Check node affinity
|
|
kubectl get nodes -L kubernetes.io/hostname
|
|
|
|
# Check storage class
|
|
kubectl get storageclass longhorn-cnpg
|
|
```
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. **Push Poimen Memory repo to GitHub** (required for ArgoCD to access it)
|
|
```bash
|
|
cd ~/workplace/Poimen/memory
|
|
git remote add origin https://github.com/Riotpiaole/Poimen-memory.git
|
|
git push -u origin main
|
|
```
|
|
|
|
2. **Push homelab changes**
|
|
```bash
|
|
cd ~/workplace/homelab
|
|
git add k8s/argocd/
|
|
git commit -m "feat: add Poimen Memory to ArgoCD tracking"
|
|
git push
|
|
```
|
|
|
|
3. **Sync homelab ArgoCD**
|
|
- ArgoCD detects changes automatically (or manual sync in UI)
|
|
- Wave 7 app appears and syncs wave 2 (databases)
|
|
|
|
4. **Verify CNPG cluster** (M2.2 complete)
|
|
```bash
|
|
kubectl get clusters -n poimen
|
|
```
|
|
|
|
5. **Create Poimen Memory app deployment** (next phase, M3)
|
|
- Deployment manifest that reads `memory-db-app` secret
|
|
- Helm chart or StatefulSet for HTTP API server
|
|
- Runs PgRepo against `memory-db-rw.poimen.svc.cluster.local`
|
|
|
|
---
|
|
|
|
## Files Modified
|
|
|
|
**Homelab repo:**
|
|
- ✅ `k8s/argocd/projects/homelab-project.yaml` — Added Poimen Memory repo
|
|
- ✅ `k8s/argocd/apps/71-poimen-memory.yaml` — New root app
|
|
|
|
**Poimen Memory repo:**
|
|
- ✅ `k8s/argocd/kustomization.yaml` — New app-of-apps root
|
|
- ✅ `k8s/argocd/memory-database-app.yaml` — Database application
|
|
- ✅ `k8s/infra/databases/memory-db.yaml` — CNPG cluster manifest
|
|
- ✅ `k8s/infra/databases/kustomization.yaml` — Kustomization
|
|
|
|
---
|
|
|
|
## Status
|
|
|
|
✅ **M2.2 CNPG Postgres** — Complete + ArgoCD tracked
|
|
✅ **Ready to deploy** — Push repos and sync homelab
|
|
⏳ **M3 Application** — Next: Poimen Memory app deployment
|
|
|