Conversation
manamana32321
left a comment
There was a problem hiding this comment.
전체
PR 제목이 fix(infra): add annotation(auto-enabled)인데, 실제로는 RDS 제거 + on-premise PostgreSQL 전환 + initContainer migration 추가 등 범위가 훨씬 큽니다. database.tf 삭제, ExternalSecret 제거, IAM 변경 등 주요 변경사항이 description에 빠져있어서 리뷰할 때 전체 그림을 파악하기 어려웠습니다.
제목을 feat(infra): migrate from AWS RDS to on-premise PostgreSQL 같이 바꾸고, description에 삭제된 리소스 목록도 포함하면 좋겠습니다.
| labels: | ||
| app: api | ||
| spec: | ||
| initContainers: |
There was a problem hiding this comment.
initContainer 방식도 replica 1개에서는 동작하지만, ArgoCD 환경이니까 PreSync Hook Job으로 분리하는 방향은 어떨까요?
apiVersion: batch/v1
kind: Job
metadata:
name: prisma-migrate
annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: BeforeHookCreationinitContainer 대비 장점:
- migration은 "배포 시 1회 실행"이 맞는 시맨틱인데, Job이 이걸 정확히 표현합니다
- replica 수와 완전히 무관해서, 다중 replica 확장 시에도 변경이 필요 없습니다
- rollout restart나 node drain 같은 변경 없는 재시작에서 불필요한 migration 재실행이 없습니다
- Job 실패 시 ArgoCD sync 자체가 실패하므로 broken deployment 방지도 자동입니다
- CI/CD 파이프라인 수정 없이 kustomization에 Job manifest만 추가하면 됩니다
npx prisma@6.19.2 네트워크 의존성 문제도 있는데, Job이든 initContainer든 Dockerfile에 prisma binary를 포함하는 게 더 안정적일 것 같습니다.
어떻게 생각하시나요?
| readinessProbe: | ||
| exec: | ||
| command: ['pg_isready', '-U', '$(POSTGRES_USER)'] | ||
| command: ['sh', '-c', 'pg_isready -U $POSTGRES_USER'] |
There was a problem hiding this comment.
API deployment에는 resource limits가 설정되어 있는데 PostgreSQL에는 없습니다. heavy query나 메모리 누수 시 노드 전체에 영향을 줄 수 있으니 최소한 limits는 설정해주면 좋겠습니다.
resources:
requests:
cpu: 0.5
memory: 512Mi
limits:
cpu: 2
memory: 2Gi| namespace: proseed-postgres | ||
| annotations: | ||
| reflector.v1.k8s.emberstack.com/reflection-allowed: 'true' | ||
| reflector.v1.k8s.emberstack.com/reflection-auto-enabled: 'true' |
There was a problem hiding this comment.
현재 reflection-auto-enabled: 'true'만 있고 reflection-auto-namespaces가 없는데, 이 경우 Reflector는 모든 네임스페이스에 미러를 시도합니다 (allowed-namespaces로 최종 필터링되긴 합니다). 의도를 명확히 하려면 reflection-auto-namespaces: 'proseed'도 추가하는 게 좋겠습니다.
reflector.v1.k8s.emberstack.com/reflection-auto-namespaces: 'proseed'
manamana32321
left a comment
There was a problem hiding this comment.
고생하셨어요~ 몇 가지 사항만 점검 부탁드립니다!
변경 사항
infra/k8s/postgres/db-credentials.yaml
infra/k8s/api/deployment.yaml
lab cluster
*참고사항