[CASCL-1292] chore(kubectl-datadog): split autoscaling install.go into smaller files#2967
[CASCL-1292] chore(kubectl-datadog): split autoscaling install.go into smaller files#2967L3n41c wants to merge 1 commit into
Conversation
Pure file-level reorganization within the install package — no behavior changes. Prepares for a future `update` subcommand that will reuse the orchestration in steps.go (the install command is already idempotent and most of its logic carries over). Layout: - install_mode.go, create_karpenter_resources.go, inference_method.go: pflag enum types and their String/Set/Type receiver methods (verbose boilerplate that obscured the install logic in the original file). - install.go (now slim): cobra command wiring — flag-bound globals, options struct, complete/validate. To be duplicated by `update`. - steps.go: orchestration — run() plus the individual steps (CloudFormation stacks, aws-auth ConfigMap, Helm release, NodePool resources, cluster-info snapshot) and the display messages. To be reused by `update` once run() is parameterized. Tests are split symmetrically. Logical content (excluding comments, blank lines, and import blocks) is byte-identical to the original. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Closed and superseded by #2968 — the GitHub branch-rename API closed this PR when the Jira ref |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2967 +/- ##
=======================================
Coverage 41.41% 41.41%
=======================================
Files 327 331 +4
Lines 28891 28891
=======================================
Hits 11964 11964
Misses 16072 16072
Partials 855 855
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What does this PR do?
Splits the 705-line
cmd/kubectl-datadog/autoscaling/cluster/install/install.go(and its 444-line test) into smaller, more cohesive files within the same Go package. No behavior change — the logical content (excluding comments, blank lines, and import blocks) is byte-identical to before.Layout after the split:
install_mode.goInstallModepflag enum +String/Set/Typecreate_karpenter_resources.goCreateKarpenterResourcespflag enum + methodsinference_method.goInferenceMethodpflag enum + methodsinstall.go(slim)options,complete,validatesteps.gorun()+ individual steps (CFN stacks, aws-auth, Helm, NodePool, cluster-info snapshot) + display messages + embedded CFN templatesTests are split symmetrically.
Motivation
The parent PR #2961 introducing
kubectl datadog autoscaling cluster installhas become too large to review comfortably. Splittinginstall.gointo smaller files makes incoming reviews and follow-ups (notably a futureupdatesubcommand that will reusesteps.go) easier to land.The split also reflects the intended division of labour for the future
update:install.go) will be duplicated byupdate.steps.go) will be reused byupdateoncerun()is parameterized to drop its dependency on theinstall-package globals (deferred to that follow-up PR).Additional Notes
String/Set/Type) lives in dedicated files now; it was crowding the install logic in the original file.steps.gostill contains(*options).runand(*options).installHelmChartcoupled to the install globals — parameterization is intentionally out of scope here and will be done as part of the PR that introducesupdate.Minimum Agent Versions
Not applicable — refactor only, no runtime change.
Describe your test plan
Pure file-level reorganization, mechanically verified:
go build ./...passesgo test ./cmd/kubectl-datadog/autoscaling/cluster/install/...— all tests passmake lint— 0 issuesinstall.go(resp.install_test.go) and the union of the new files is empty modulo comments / blank lines /package+importlinesChecklist
refactoringqa/skip-qalabel set (no runtime behavior changes)