Skip to content

refactor: keiailab-commons v0.11.0 채택 — Latency 누수 fix + exporter pin (-706 LOC)#285

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

refactor: keiailab-commons v0.11.0 채택 — Latency 누수 fix + exporter pin (-706 LOC)#285
KeiaiLab-PHIL merged 1 commit into
mainfrom
refactor/adopt-commons-v0.11.0

Conversation

@KeiaiLab-PHIL

Copy link
Copy Markdown
Contributor

사용자 시나리오

operator 유지보수자가 probe/status/apply/cert/메트릭 보일러플레이트를 본 repo 에서 직접 유지하지 않고 keiailab-commons v0.11.0 한 곳에서 import 한다. 27 files, +484/−706.

의도된 거동 변화 (게이트 agent 실측)

변화 영향
Latency 시계열 누수 fix 2중: ① 구 DeleteMetricsFor 가 duration_seconds 미삭제 → 삭제 CR 의 latency 영구 잔존 ② NotFound 경로 defer 가 latency 1건 재생성 commons DeleteFor (trio 전체 삭제) + crDeleted flag — cardinality 누수 차단 (fix)
applyErrorCondition false-transition fix: LastTransitionTime 매 reconcile 갱신 → status 변경 시만 condition 시간 정확성 (fix)
updateStatusWithRetry 폐기 → commons UpdateWithRetry 구판은 conflict 시 stale ResourceVersion 무효 재시도 (결함). refetch+mutate 로 교체, 19 콜사이트
exporter default oliver006/redis_exporter:latestv1.86.0 pin (const SSOT + CRD 4 file) 기존 CR persist 값 소급 없음 — 신규/미설정분부터
Certificate issuerRef.group: cert-manager.io 명시 emit 빈 group 동일 해석 — 재발급 트리거 없음
SchemeGroupVersion → GroupVersion rename kubebuilder 컨벤션 정합 (잔존 0)

핵심 보존 검증

  • 메트릭 fqName byte-동일: valkey_cluster_reconcile_{total,duration_seconds,errors_total} — Help/bucket 12종/라벨 동일. Valkey controller 의 Total 미집계 비대칭은 행동 보존 위해 유지
  • 기존 테스트 삭제 0 (TestExporterImage 만 const 참조로 기대값 전환)

검증

go test -race ./...   # envtest 실 구동 (controller 19.5s + webhook 7.2s), FAIL 0
golangci-lint run     # 0 issues (사전 존재 포함)
make generate manifests  # drift 0 / git grep -i bitnami → 0건

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

Refs: KeiaiLab/keiailab-commons#77

… (-706 LOC)

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

의도된 거동 변화 (gate 검증 완료):
- reconcile Latency 시계열 누수 fix 2중:
  ① 구 DeleteMetricsFor 가 duration_seconds 를 삭제하지 않아 삭제 CR 의
    latency 시계열 영구 잔존 → commons DeleteFor 가 trio 전체 삭제
  ② CR 삭제 (NotFound) 경로에서 defer 가 latency 1건 재생성 →
    crDeleted flag 로 삭제 경로 관측 skip
- applyErrorCondition false-transition fix: ReconcileError condition 의
  LastTransitionTime 이 매 reconcile 갱신되던 결함 → meta.SetStatusCondition
  (status 변경 시만 갱신). phase/이벤트/RequeueAfter 30s/메시지 동일
- updateStatusWithRetry 폐기 → commons UpdateWithRetry (refetch+mutate.
  구판은 conflict 시 stale ResourceVersion 무효 재시도). 19 콜사이트
- exporter default: oliver006/redis_exporter:latest → v1.86.0 pin
  (DefaultExporterImage const SSOT, v1alpha1+v1alpha2 + CRD 4 file 동기.
  기존 CR persist 값 소급 없음)
- Certificate CR spec.issuerRef.group: cert-manager.io 명시 emit
  (빈 group 동일 해석 — 재발급 트리거 없음, commons doc 검증)
- webhook storageClassName 거절 문구 commons 표준 문구로 (규칙 동일)
- SchemeGroupVersion → GroupVersion rename (kubebuilder 컨벤션 정합)

핵심 보존 검증:
- 메트릭 fqName byte-동일: valkey_cluster_reconcile_{total,
  duration_seconds,errors_total} — subsystem "valkey_cluster" 주입.
  Valkey controller 의 Total 미집계 비대칭은 행동 보존 위해 유지
- Latency=defer 관측 / Total=진입 Inc 시점 동일
- 기존 테스트 삭제 0 (TestExporterImage 만 const 참조로 기대값 전환)

검증:
- go build+vet 0 에러 / go test -race ./... FAIL 0 (envtest 실 구동)
- golangci-lint 0 issues (사전 존재 이슈 포함 0) / generated drift 0
- CI golang go.mod 정합 + git grep -i bitnami 0건

후속: release 시 make bundle 재생성 (OLM manifests exporter default 반영)

Refs: KeiaiLab/keiailab-commons#77
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@KeiaiLab-PHIL KeiaiLab-PHIL merged commit d4af57c into main Jun 11, 2026
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