6878b61efa
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>
129 lines
4.6 KiB
Markdown
129 lines
4.6 KiB
Markdown
# cnpg-cluster 버전 갱신 가이드
|
|
|
|
이 차트는 **PaaSup 자체 제작**이다. 업스트림 차트를 내려받는 `cloudnative-pg` 와 달리
|
|
`helm pull` 로 갱신하지 않는다. 갱신 사유는 두 가지다.
|
|
|
|
1. PostgreSQL major 버전 상향 (예: 18 → 19)
|
|
2. CNPG operator 버전 상향으로 CRD 필드가 바뀐 경우
|
|
|
|
## 1. git 작업 환경 구성
|
|
|
|
```sh
|
|
git clone https://github.com/paasup/dip-catalog.git
|
|
cd dip-catalog
|
|
git checkout -b update-cnpg-cluster/<신규버전>
|
|
```
|
|
|
|
## 2. 신규 버전 디렉토리 생성
|
|
|
|
```sh
|
|
NEW=1.1.0
|
|
OLD=1.0.0
|
|
cd manifests/helm/cnpg-cluster
|
|
cp -R "$OLD" "$NEW"
|
|
# Chart.yaml 의 version / appVersion 갱신
|
|
```
|
|
|
|
| 필드 | 의미 |
|
|
| --- | --- |
|
|
| `version` | 이 차트의 버전 (디렉토리명과 일치시킨다) |
|
|
| `appVersion` | 배포되는 PostgreSQL 버전 |
|
|
|
|
## 3. CRD 스키마 대조
|
|
|
|
operator 를 올렸다면 `Cluster` / `Database` / `Pooler` / `ScheduledBackup` CRD 스키마가
|
|
바뀌었을 수 있다. 템플릿이 쓰는 필드가 아직 존재하는지 확인한다.
|
|
|
|
```sh
|
|
# 템플릿이 참조하는 spec 필드 목록 확인
|
|
kubectl get crd clusters.postgresql.cnpg.io -o json | python3 -c "
|
|
import json,sys
|
|
d=json.load(sys.stdin)
|
|
print(sorted(d['spec']['versions'][0]['schema']['openAPIV3Schema']
|
|
['properties']['spec']['properties'].keys()))
|
|
"
|
|
|
|
kubectl get crd databases.postgresql.cnpg.io -o json | python3 -c "
|
|
import json,sys
|
|
d=json.load(sys.stdin)
|
|
print(sorted(d['spec']['versions'][0]['schema']['openAPIV3Schema']
|
|
['properties']['spec']['properties'].keys()))
|
|
"
|
|
```
|
|
|
|
## 4. 렌더링·검증
|
|
|
|
```sh
|
|
NEW=1.1.0
|
|
cd manifests/helm/cnpg-cluster/$NEW
|
|
|
|
# 1) lint
|
|
helm lint . -f custom-values.yaml
|
|
|
|
# 2) 기본 경로 렌더링
|
|
helm template pg-cnpg . -f custom-values.yaml -n test >/dev/null && echo OK
|
|
|
|
# 3) 옵션 경로(backup/pooler/scheduledBackup) 렌더링 — 기본값이 false 이므로 별도 확인 필요
|
|
helm template pg-cnpg . -f custom-values.yaml -n test \
|
|
--set backup.enabled=true \
|
|
--set backup.barmanObjectStore.destinationPath=s3://x/y \
|
|
--set backup.barmanObjectStore.s3Credentials.accessKeyId.name=s \
|
|
--set backup.barmanObjectStore.s3Credentials.secretAccessKey.name=s \
|
|
--set scheduledBackup.enabled=true \
|
|
--set pooler.enabled=true >/dev/null && echo "옵션 경로 OK"
|
|
|
|
# 4) 실제 API 서버 + CNPG webhook 검증 (스키마 위반을 여기서 잡는다)
|
|
helm template pg-dryrun . -f custom-values.yaml -n <기존ns> \
|
|
| kubectl apply --dry-run=server -f -
|
|
```
|
|
|
|
4단계가 가장 중요하다. `helm template` 은 CRD 스키마를 검사하지 않으므로 렌더링이 통과해도
|
|
실제 apply 에서 거부될 수 있다.
|
|
|
|
## 5. 렌더링 결과 비교
|
|
|
|
```sh
|
|
helm template pg . "$OLD" -f "$OLD/custom-values.yaml" -n test > /tmp/old.yaml 2>/dev/null || \
|
|
helm template pg "$OLD" -f "$OLD/custom-values.yaml" -n test > /tmp/old.yaml
|
|
helm template pg "$NEW" -f "$NEW/custom-values.yaml" -n test > /tmp/new.yaml
|
|
diff -u /tmp/old.yaml /tmp/new.yaml
|
|
```
|
|
|
|
## 6. 배포 검증
|
|
|
|
개발 클러스터에 실제 배포해 `doc/charts/cnpg/deploy-test.md` 의 검증 항목을 재실행한다.
|
|
최소 통과 기준:
|
|
|
|
1. `readyInstances = instances`, `phase = Cluster in healthy state`
|
|
2. `-rw` / `-ro` 서비스 라우팅 분리 (`pg_is_in_recovery()` 가 `f` / `t`)
|
|
3. `-ro` 로 쓰기 시도 시 `read-only transaction` 오류
|
|
4. `databases[].extensions` 가 primary·전체 replica 에 모두 생성됨
|
|
5. primary Pod 삭제 → failover 후 쓰기 복구, failover 전후 데이터 보존
|
|
6. `postgresql.parameters` 가 `SHOW` 로 실제 반영 확인
|
|
|
|
### PostgreSQL major 버전 상향 시 추가 확인
|
|
|
|
- 확장 호환성: `pgaudit`, `pg_stat_statements` 의 신규 major 대응 버전 존재 여부
|
|
- `postgresql.parameters` 중 제거·개명된 GUC 가 있는지
|
|
- major 업그레이드는 in-place 가 아니다. CNPG 는 논리 복제(`import`) 또는
|
|
새 클러스터 생성 후 데이터 이관 방식을 쓴다. `imageName` 만 바꾸면 기동에 실패한다.
|
|
|
|
## 7. 문서 갱신
|
|
|
|
| 파일 | 갱신 내용 |
|
|
| --- | --- |
|
|
| `CUSTOM-README.md` | 차트/PostgreSQL 버전, 변경된 values 키, operator 호환 버전 |
|
|
| `BUILD-README.md` | 이 문서의 절차에 변경이 있으면 반영 |
|
|
| `dip-values.yaml` / `dip-*-quotas.yaml` | 파라미터 이름이 바뀌었으면 반영 |
|
|
| `doc/charts/cnpg/deploy-test.md` | 신규 버전 검증 결과 추가 |
|
|
|
|
## 8. PR
|
|
|
|
```sh
|
|
git add manifests/helm/cnpg-cluster/<신규버전> doc/
|
|
git commit -m "cnpg-cluster <신규버전> 추가 (PostgreSQL <버전>)"
|
|
git push -u origin update-cnpg-cluster/<신규버전>
|
|
```
|
|
|
|
`helm-catalog-sbom` 워크플로가 PR 에서 변경 차트의 SBOM·취약점 스캔을 수행한다.
|