refactor: keiailab-commons 빌더 7종 전면 채택 (-115 LOC)#304
Merged
Conversation
valkey 의 리소스 빌더 3종을 keiailab-commons 공유 패키지로 위임한다 (중복 제거,
역할/책임 분리). exported 시그니처는 유지 → 컨트롤러 호출부 변경 0.
- resources/pdb.go BuildPDB/BuildShardPDB → commons pdb.Build (DefaultFloor=1).
valkey 의 MaxUnavailable-우선 정밀도는 pdbParamsFromSpec 에서 보존.
- resources/hpa.go BuildHorizontalPodAutoscaler → commons hpa.Build (MinFloor=2)
+ CPUUtilization/MemoryUtilization 헬퍼. metric 조립(CPU 기본 70 + opt-in Mem)은
valkey 도메인 잔류.
- controller/tls_cert_hash.go hashTLSSecret → commons secrethash.Hash
(키 순서 tls.crt/tls.key/ca.crt 동일 → annotation byte-identical, rollout 0).
commons 의존: v0.12.1-0.20260630004504-13e0976fc111 (keiailab-commons#86).
머지+릴리스 후 tag 버전으로 bump 예정.
검증:
go build ./... → OK
go vet ./internal/{resources,controller}/... → clean
go test ./internal/resources/... → ok
KUBEBUILDER_ASSETS=... go test ./internal/controller/... → ok (16.9s, envtest 전체 suite)
순감소 ~41 LOC (62 ins / 103 del).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: phil <phil@keiailab.com>
valkey 의 잔여 리소스 빌더를 keiailab-commons 2차 배치로 위임 (역할/책임 분리). - resources/service.go: BuildHeadlessService/ClientService/MetricsService/PrimaryService 4종 → commons service.Build. ServiceSpec 옵션 병합 + clientPorts 는 valkey 잔류. - resources/statefulset.go: dataPVC → commons pvc.BuildDataPVC, tlsVolumes/tlsVolumeMounts → commons volume.TLSSecretMount (0o400/readonly cert 불변식 SSOT). commons 의존 → v0.12.1-0.20260630011743-a54c4a826028 (keiailab-commons#86 2차). 검증: go build ./... → OK go vet ./internal/resources/... → clean golangci-lint → 신규 이슈 0 (기존 2건은 무관 파일) go test ./internal/resources/... → ok KUBEBUILDER_ASSETS=… go test ./internal/controller/... → ok (16.7s, envtest 전체 suite) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: phil <phil@keiailab.com>
valkey 의 배치 Job 빌더 3종을 keiailab-commons/pkg/batchjob.Build 로 위임. exported 시그니처 유지 → 호출부 변경 0. - resources/backup_job.go BuildBackupJob (rdb-copy) - resources/upload_job.go BuildUploadJob (S3 업로드) - resources/download_job.go BuildDownloadJob (S3 다운로드) Job/PodTemplate 엔벨로프(BackoffLimit=2/TTL=86400/RestartPolicyOnFailure/라벨전파)는 commons SSOT, 컨테이너(valkey-cli/operator)·볼륨·SecurityContext 조립은 valkey 잔류. 검증: go build OK / vet clean / golangci-lint 신규 0 / resources test ok / KUBEBUILDER_ASSETS=… controller envtest 전체 suite ok. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: phil <phil@keiailab.com>
commons#86 머지 + v0.13.0 릴리스 후 clean tag 로 고정. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: phil <phil@keiailab.com>
399f1cd to
3094480
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약 — keiailab-commons 빌더 7종 전면 채택
valkey 의 리소스/컨트롤러 빌더를
keiailab-commons공유 패키지로 위임 (중복 제거). exported 시그니처 유지 → 컨트롤러 호출부 변경 0. 순변화 -115 LOC (222+/337-).hashTLSSecretsecrethash.Hash(키 순서 동일 → byte-identical)BuildPDB/BuildShardPDBpdb.Build(DefaultFloor=1, MaxUnavailable-우선 보존)BuildHorizontalPodAutoscalerhpa.Build(MinFloor=2) + CPU/Mem 헬퍼service.Build(옵션병합·clientPorts 잔류)pvc.BuildDataPVCvolume.TLSSecretMount(0o400)batchjob.Build(엔벨로프)commons PR KeiaiLab/keiailab-commons#86. go.mod = pseudo
v0.12.1-0.20260630011743-a54c4a826028. commons 릴리스(v0.13.0) 후 tag bump → draft.검증 (커밋별)
거동 보존: 기존 pdb/hpa/tls/service/pvc/backup 테스트 전부 통과.
🤖 Generated with Claude Code