Phase 4o: Add PVC for photo uploads — survive pod restarts #72

Closed
opened 2026-03-13 19:50:30 +00:00 by forgejo_admin · 0 comments

Lineage

plan-2026-03-08-tryout-prep → Phase 4 → Phase 4o

Repo

forgejo_admin/basketball-api

User Story

As an admin
I want player photos to persist across pod restarts
So that coaches can see player photos during tryouts even after deployments

Context

The app stores uploaded photos at /data/uploads/photos (configured in config.py:18). The main app mounts this as a static files directory at /uploads/photos. Currently this is ephemeral container storage — when the pod restarts (deploy, crash, node reboot), all photos are lost. 23 of 45 players have photos that need to survive.

The deployment already uses strategy: Recreate (not RollingUpdate), so a single ReadWriteOnce PVC is fine.

File Targets

Files to modify:

  • k8s/deployment.yaml — add PVC volume + volumeMount at /data/uploads/photos

Files to create:

  • k8s/pvc.yaml — PersistentVolumeClaim (1Gi, ReadWriteOnce, default storage class)

Files to update:

  • k8s/kustomization.yaml — add pvc.yaml to resources list

Files NOT to touch:

  • src/ — no code changes needed, the app already uses the correct path
  • k8s/postgres.yaml — separate concern

Acceptance Criteria

  • PVC created in basketball-api namespace
  • Pod mounts PVC at /data/uploads/photos
  • After pod restart, previously uploaded photos are still accessible
  • Photo upload endpoint (POST /upload/photo) still works
  • Photo serving (/uploads/photos/...) still works

Test Expectations

  • kubectl get pvc -n basketball-api shows Bound PVC
  • Upload a photo, restart pod (kubectl rollout restart), verify photo still served
  • Existing photo URLs return 200 (once photos are re-uploaded)

Constraints

  • Use local-path storage class (k3s default)
  • 1Gi should be plenty (photos are small JPEGs)
  • strategy: Recreate means no multi-attach concerns
  • Do NOT use hostPath — use a proper PVC for portability

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • project-westside-basketball
  • Phase 4 tryout day operations
### Lineage `plan-2026-03-08-tryout-prep` → Phase 4 → Phase 4o ### Repo `forgejo_admin/basketball-api` ### User Story As an admin I want player photos to persist across pod restarts So that coaches can see player photos during tryouts even after deployments ### Context The app stores uploaded photos at `/data/uploads/photos` (configured in `config.py:18`). The main app mounts this as a static files directory at `/uploads/photos`. Currently this is ephemeral container storage — when the pod restarts (deploy, crash, node reboot), all photos are lost. 23 of 45 players have photos that need to survive. The deployment already uses `strategy: Recreate` (not RollingUpdate), so a single ReadWriteOnce PVC is fine. ### File Targets Files to modify: - `k8s/deployment.yaml` — add PVC volume + volumeMount at `/data/uploads/photos` Files to create: - `k8s/pvc.yaml` — PersistentVolumeClaim (1Gi, ReadWriteOnce, default storage class) Files to update: - `k8s/kustomization.yaml` — add `pvc.yaml` to resources list Files NOT to touch: - `src/` — no code changes needed, the app already uses the correct path - `k8s/postgres.yaml` — separate concern ### Acceptance Criteria - [ ] PVC created in basketball-api namespace - [ ] Pod mounts PVC at `/data/uploads/photos` - [ ] After pod restart, previously uploaded photos are still accessible - [ ] Photo upload endpoint (`POST /upload/photo`) still works - [ ] Photo serving (`/uploads/photos/...`) still works ### Test Expectations - [ ] `kubectl get pvc -n basketball-api` shows Bound PVC - [ ] Upload a photo, restart pod (`kubectl rollout restart`), verify photo still served - [ ] Existing photo URLs return 200 (once photos are re-uploaded) ### Constraints - Use `local-path` storage class (k3s default) - 1Gi should be plenty (photos are small JPEGs) - `strategy: Recreate` means no multi-attach concerns - Do NOT use hostPath — use a proper PVC for portability ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-westside-basketball` - Phase 4 tryout day operations
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/basketball-api#72
No description provided.