[CASCL-1323] chore(kubectl-datadog): split autoscaling install.go into smaller files#2968
Merged
Merged
Conversation
8 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2968 +/- ##
=======================================
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:
|
This comment has been minimized.
This comment has been minimized.
install.go into smaller files
…o smaller files 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]>
L3n41c
force-pushed
the
lenaic/CASCL-1292-split-install-go
branch
from
May 4, 2026 14:44
1e9e6f5 to
66ec55f
Compare
install.go into smaller files
L3n41c
marked this pull request as ready for review
May 4, 2026 15:23
Member
Author
|
This PR only moves lines of code and GitHub isn’t very good at showing that lines of code have been moved and not just deleted and added elsewhere. I’d recommend a command like like: $ git diff --stat -p -n 1 --find-copies --color-moved origin/main...origin/lenaic/CASCL-1292-split-install-goto validate that code has been moved and not changed. |
clamoriniere
approved these changes
May 4, 2026
gabedos
approved these changes
May 4, 2026
L3n41c
added a commit
that referenced
this pull request
May 4, 2026
…tallation PR #2968 split install.go into multiple files; the foreign-Karpenter detection block and `displayForeignKarpenterMessage` moved to steps.go, and the matching tests moved to steps_test.go. Conflicts resolved by taking origin/main's slim install.go / install_test.go and re-applying this branch's `FindKarpenterInstallation` + `KarpenterInstallation` adaptation against the new locations (steps.go callsite + display signature; steps_test.go type + assertion message). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
L3n41c
added a commit
that referenced
this pull request
May 4, 2026
…tallation PR #2968 split install.go into multiple files; the foreign-Karpenter detection block and `displayForeignKarpenterMessage` moved to steps.go, and the matching tests moved to steps_test.go. Conflicts resolved by taking origin/main's slim install.go / install_test.go and re-applying this branch's `FindKarpenterInstallation` + `KarpenterInstallation` adaptation against the new locations (steps.go callsite + display signature; steps_test.go type + assertion message). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
L3n41c
added a commit
that referenced
this pull request
May 4, 2026
…tallation PR #2968 split install.go into multiple files; the foreign-Karpenter detection block and `displayForeignKarpenterMessage` moved to steps.go, and the matching tests moved to steps_test.go. Conflicts resolved by taking origin/main's slim install.go / install_test.go and re-applying this branch's `FindKarpenterInstallation` + `KarpenterInstallation` adaptation against the new locations (steps.go callsite + display signature; steps_test.go type + assertion message). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
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)