자체 빌드 이미지 3종(cloudnative-pg/cnpg-postgresql/etcd) + 대응 헬름 차트 도입

security-catalog 프로젝트에서 첫 실사용 자체 빌드 이미지 3종을 포팅한다 — 전부
상위 태그·베이스 OS 교체로 해소 안 되는 CVE(Go 모듈 정적 링크 또는 미수정 CRITICAL/
HIGH)를 자체 빌드(소스 컴파일 또는 SUSE BCI 재설치)로 대응한다:

- images/cloudnative-pg: CNPG operator, release-1.30 소스 컴파일 + bci-micro
- images/cnpg-postgresql: PostgreSQL 18.4, bci-base + zypper 재설치
- images/etcd: etcd v3.7.1, 소스 컴파일(x/text 강제 업그레이드) + bci-micro

함께 추가:
- manifests/helm/{cloudnative-pg,cnpg-cluster,etcd} — 위 이미지를 참조하는 카탈로그 차트
- scripts/deploy-test/*.sh, .claude/deploy-test-procedure.md — CVE 0건과 별개로
  "실제로 뜨는가"를 검증하는 배포 스모크 테스트
- .claude/pitfalls.md — 자체 빌드/배포 테스트 중 실측한 함정 모음

검토 중 발견해 반영한 수정:
- cloudnative-pg 차트의 image 블록을 etcd와 동일한 registry/repository/tag 3필드+
  따옴표 포맷으로 통일 — 기존 포맷(repository에 registry+repo 결합, 따옴표 없음)은
  patch-catalog-tag.py 의 split 패처가 tag만 갱신하고 repository는 그대로 남기는
  조용한 부분 치환을 일으켜, 향후 레지스트리 마이그레이션 시 깨진 참조를 만들 수 있었다
- cnpg-cluster 차트의 SLES 커버리지 코멘트를 최신 실측(trivy가 SLES 15.7을 정상
  커버함, 2026-07-29 재측정)에 맞게 정정 — 폐기된 "측정 불가/OVAL 우회 필요" 결론이
  남아있었다
- CLAUDE.md/MEMORY.md 의 "images/ 디렉토리 없음" 서술을 갱신하고, 레지스트리
  마이그레이션(docker.io/wbsong111 → docker.io/paasup)·decisions/analysis 문서 이관·
  리소스 프로파일 추가를 다음 작업으로 기록

이 3개 이미지는 아직 dip-catalog 자체 CI(build-image.yml)로 빌드·게이트·push 를
실행해본 적이 없다 — 현재 참조 태그는 security-catalog 쪽에서 이미 검증된 것이다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
wbsong111
2026-08-03 12:03:37 +09:00
parent a168a3c7e6
commit 6878b61efa
89 changed files with 36608 additions and 11 deletions
@@ -0,0 +1,123 @@
# cnpg-cluster — PaaSup 오버라이드
# 사전 조건: cloudnative-pg operator(차트 0.29.0 / operator 1.30.0)가 설치되어 있어야 한다.
instances: 3
postgresql:
# SUSE BCI 15.7 기반 자체 하드닝 빌드로 교체했다 (2026-07-28).
# 결정 근거·받아들인 비용 → doc/decisions/0001-cnpg-postgresql-image.md
# 빌드 정의 → images/cnpg-postgresql/suse.Dockerfile + suse.build.env
#
# 태그에 빌드일을 포함한다. 같은 앱 버전이라도 베이스 업데이트 결과가 시점마다 다르므로
# 롤링 태그를 쓰지 않는다 (doc/image-selection.md 2번).
imageName: "docker.io/wbsong111/cnpg-postgresql:18.4-bci15.7-hardened-20260729"
#
# trivy 는 SLES 15.7 을 정상 커버한다(2026-07-29 재측정, 양성 대조로 13건 실측 —
# doc/analysis/sles-oval-measurement.md). 2026-07-28 시점에는 "trivy 가 SLES 15.7
# 데이터를 커버하지 않아 0건이 측정 불가다"로 판단해 OVAL 직접 평가로 우회했으나
# 이는 오판이었던 것으로 정정됐다 — 실효 C/H 0/0 은 실제 결과다. 게이트 PASS.
#
# ⚠️ pg-failover-slots 확장이 없다 — PGDG zypp 저장소에 패키지가 없다.
# 이 차트는 쓰지 않지만 상위 구성에서 요구하면 확인해야 한다.
#
# 이전 값: ghcr.io/cloudnative-pg/postgresql:18.4-system-trixie
# 업스트림 deprecated 타입이었고 실효 CRITICAL/HIGH 6/26 (차단 32건) 이었다.
# 그 32건은 전부 수정 버전이 없어 어떤 조치로도 해소되지 않는다.
# image:
# repository: ghcr.io/cloudnative-pg/postgresql
# tag: "18.4-standard-trixie"
parameters:
max_connections: "200"
shared_buffers: 256MB
work_mem: 8MB
maintenance_work_mem: 128MB
effective_cache_size: 1GB
log_timezone: Asia/Seoul
timezone: Asia/Seoul
# 감사 로깅. CNPG 기본 이미지에 pgaudit 가 포함되어 있다.
sharedPreloadLibraries:
- pgaudit
- pg_stat_statements
primaryUpdateStrategy: unsupervised
primaryUpdateMethod: switchover
storage:
size: 20Gi
storageClass: longhorn
walStorage:
enabled: true
size: 10Gi
storageClass: longhorn
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: "2"
memory: 2Gi
bootstrap:
initdb:
database: appdb
owner: appuser
# 비밀번호를 직접 관리할 때 지정. 미지정 시 operator 가 <release>-app 시크릿에 자동 생성한다.
# secretName: "$INFISICAL_SECRET"
encoding: UTF8
# CREATE EXTENSION 은 여기에 넣지 않는다 (CNPG 1.30.0 에서 무시됨). 아래 databases 로 선언한다.
postInitApplicationSQL: []
# 확장은 Database CRD 로 선언한다. sharedPreloadLibraries 에 올린 것과 짝을 맞춘다.
databases:
- name: appdb
owner: appuser
ensure: present
reclaimPolicy: retain
extensions:
- name: pg_stat_statements
- name: pgaudit
# postgres superuser 직접 접속 차단. 시크릿 자체가 생성되지 않는다.
enableSuperuserAccess: false
affinity:
enablePodAntiAffinity: true
# 단일 노드 dev 환경에서는 preferred 여야 3 인스턴스가 스케줄된다.
# 노드 수 >= instances 인 운영 환경에서는 required 로 변경한다.
podAntiAffinityType: preferred
topologyKey: kubernetes.io/hostname
nodeSelector: {}
tolerations: []
monitoring:
# rancher-monitoring(Prometheus Operator) 설치 환경에서만 true
enablePodMonitor: false
# 백업 — 운영 배포 시 반드시 활성화한다. 미설정이면 PITR 불가.
backup:
enabled: false
retentionPolicy: 30d
barmanObjectStore:
destinationPath: "" # 예: s3://pg-backup/cnpg
endpointURL: "" # 예: http://rustfs.defense-llm.svc.cluster.local:9000
s3Credentials:
accessKeyId:
name: "" # 예: pg-backup-s3
key: ACCESS_KEY_ID
secretAccessKey:
name: ""
key: ACCESS_SECRET_KEY
scheduledBackup:
enabled: false
schedule: "0 0 2 * * *" # 6필드 cron — 매일 02:00
pooler:
enabled: false
instances: 2
type: rw
poolMode: transaction