Skip to content

refactor: keiailab-commons v0.11.0 채택 — 자체구현 7 표면 제거 (-1,025 LOC)#312

Merged
KeiaiLab-PHIL merged 1 commit into
mainfrom
refactor/adopt-commons-v0.11.0
Jun 11, 2026
Merged

refactor: keiailab-commons v0.11.0 채택 — 자체구현 7 표면 제거 (-1,025 LOC)#312
KeiaiLab-PHIL merged 1 commit into
mainfrom
refactor/adopt-commons-v0.11.0

Conversation

@KeiaiLab-PHIL

Copy link
Copy Markdown
Contributor

사용자 시나리오

operator 유지보수자가 reconcile 보일러플레이트 (idempotent apply / status condition / 에러 condition / cert 발급 / reconcile 메트릭 / PrometheusRule / SecurityContext) 를 본 repo 에서 직접 유지하지 않고 keiailab-commons v0.11.0 한 곳에서 import 한다. 34 files, +417/−1,025.

핵심 보존 검증 (게이트 agent 실측)

  • 메트릭 fqName byte-동일: mongodb_reconcile_{total,duration_seconds,errors_total}reconcilemetrics.New("mongodb") subsystem 주입. Help 3종/bucket 12종/라벨 동일. 자체 trio init() 등록 제거 → duplicate registration 0. 기존 Grafana 대시보드/알림 무영향.
  • 기존 단위 테스트 삭제 0 — commons 호출 검증으로 전환 (Gather 기반 mongodb_* ≥33 카운트 + PrometheusRule 15 rule 행동 검증 유지)

의도된 거동 변화

변화 영향
apply.Service nil-guard (AllocateLoadBalancerNodePorts 등 server-default 보존) generation ping-pong 방어 (fix)
apply.StatefulSet conflict 시 RetryOnConflict 기존 즉시 에러 → 재시도 (안전 방향)
pod seccompProfile=RuntimeDefault 추가 (PSA restricted) 업그레이드 시 1회 rolling restart
exporter 0.40 → percona/mongodb_exporter:0.51.0 통일 default 미지정 CR exporter 재기동
backup verification mongo:8.0 → mongo:8.3.1 (defaultImage SSOT) 이미지 일원화
ApplyErrorCondition 메시지 구분자 - : condition Message 표기만
CI golang:1.23 → 1.26 + Bitnami 표현 중립화 인프라 정합

검증

make test   # manifests+generate+fmt+vet+envtest+go test -race — 전체 PASS (FAIL 0)
golangci-lint run  # 0 issues
make generate manifests  # generated drift 0

후속 (release 시): make bundle 재생성으로 OLM CSV 의 exporter default 반영.

Refs: KeiaiLab/keiailab-commons#77

3-operator 라이브러리 스타일 일관 리팩토링 (keiailab-commons#77 Phase B).
status/apply/reconcile/certmanager/reconcilemetrics/monitoring/security 의
자체구현을 commons v0.11.0 호출로 교체.

핵심 보존 검증:
- 메트릭 fqName byte-동일: mongodb_reconcile_{total,duration_seconds,
  errors_total} — subsystem "mongodb" 주입, Help/bucket 12종/라벨 동일.
  자체 trio init() 등록 제거 → duplicate registration 0
- 기존 단위 테스트 삭제 0 (commons 호출 검증으로 전환, 회귀 가드 유지)

의도된 거동 변화 (gate 검증 완료):
- apply.Service nil-guard: AllocateLoadBalancerNodePorts/LoadBalancerClass
  server-default 보존 (기존: nil 덮어쓰기 — generation ping-pong 방어)
- apply.StatefulSet conflict 시 RetryOnConflict 재시도 (기존: 즉시 에러)
- pod-level seccompProfile=RuntimeDefault 추가 (PSA restricted 정합) —
  업그레이드 시 STS/Deployment 1회 rolling restart
- exporter 3-way drift 통일: percona/mongodb_exporter 0.40 → 0.51.0
  (const + v1alpha1/v1beta1 CRD default + config/charts CRD yaml 동기)
- 이미지 SSOT: backup verification mongo:8.0 → mongo:8.3.1 (defaultImage)
- ApplyErrorCondition 메시지 구분자 '- ' → ': '
- PrometheusRule 빌더 YAML string → unstructured CR 반환 (15 rule 동일)
- CI golang:1.23 → 1.26 (go.mod 정합) + Bitnami 표현 중립화

검증:
- make test (manifests+generate+fmt+vet+envtest+go test -race): 전체 PASS
- golangci-lint: 0 issues / generated drift 0
- 후속: release 시 make bundle 재생성 (OLM CSV exporter default 반영)

Refs: KeiaiLab/keiailab-commons#77
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@KeiaiLab-PHIL KeiaiLab-PHIL merged commit d8d80e0 into main Jun 11, 2026
14 of 16 checks passed
@KeiaiLab-PHIL KeiaiLab-PHIL deleted the refactor/adopt-commons-v0.11.0 branch June 11, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant