refactor: builder.go 거대 파일 리소스 concern 별 분리 (역할/책임 분리)#383
Merged
Conversation
2593 LOC 단일 builder.go 를 응집 리소스 그룹별 파일로 분리. 순수 함수 재배치 (같은 package, 로직/시그니처 변경 0). builder.go: 2593 → 2013 LOC. - builder_hpa.go (154 LOC, 11 func): HPA 빌더 + Is*Active/Deliberate 가드 + metric. - builder_backup.go (271 LOC, 4 func): Backup/Restore Job + CronJob + script. - builder_policy.go (204 LOC, 7 func): PDB + NetworkPolicy (RS + sharded). 검증: gofmt 0 / goimports / go build OK / go vet clean / golangci-lint 0 issues / go test resources ok / KUBEBUILDER_ASSETS=… controller envtest 전체 suite ok (19.6s). 후속: service/tls/configmap 빌더(builder.go 내 산재)도 동일 패턴 분리 가능 (이번 PR 은 연속 블록 backup/policy/hpa 만 — 저위험). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: phil <phil@keiailab.com>
builder.go 분리로 "MONGODB_URI" env 이름 리터럴이 package-wide 4회로 goconst threshold 초과 → envMongoDBURI 상수로 통일 (builder.go ×2 + builder_backup.go ×2). 검증: gofmt 0 / go build OK / vet clean / golangci-lint 0 issues / resources test ok. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: phil <phil@keiailab.com>
KeiaiLab-PHIL
added a commit
that referenced
this pull request
Jun 30, 2026
builder.go(2017→1837 LOC)에서 TLS + ConfigMap 빌더를 응집 파일로 추가 분리 (순수 재배치, 로직/시그니처 변경 0). hpa/backup/policy(1차, #383)에 이어 누적 builder.go 2705→1837 LOC (-32%, 6 concern 파일). - builder_tls.go (121 LOC): PEM merge init container + TLS volume/mount/args. - builder_configmap.go ( 89 LOC): MongoDB/Custom/cfg/shard scripts ConfigMap. 공유 const(MongoTLSMountPath/PEMPath, scriptReadiness 등) + script helper 는 builder.go 잔류(같은 package 참조). 검증: gofmt 0 / go build OK / vet clean / golangci-lint 0 issues / 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>
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.
요약
2593 LOC 단일
builder.go를 응집 리소스 그룹별 파일로 분리 — 순수 함수 재배치(같은 package, 로직/시그니처 변경 0).builder.go: 2593 → 2013 LOC.builder_hpa.gobuilder_backup.gobuilder_policy.go직전 분석이 지적한
builder.go거대 파일(9+ 리소스 종류 단일 파일) 역할/책임 분리.검증
후속
service/tls/configmap빌더(builder.go 내 산재)도 동일 패턴 분리 가능. 본 PR 은 연속 블록(backup/policy/hpa)만 — 저위험 우선.🤖 Generated with Claude Code