refactor: apis becomes nodeclass, with nodeclaimhash and resolved under it #42

Merged
mikluko merged 1 commit from move-nodeclass into main 2026-12-01 06:40:33 +00:00
Owner

Move of the layout by concept (map kit-a1f, ticket kit-a1f.5). apis becomes nodeclass. As controller-gen's package, it keeps only what controller-gen consumes. The logic built on its types moves beneath it:

  • controllers/nodeclaimhash becomes nodeclass/nodeclaimhash.
  • ObservedGeneration and CurrentResolved move to nodeclass/resolved, where CurrentResolved is now resolved.Current.

The old paths forward for one release. Two calls need a hand edit after go fix, because both infer a type argument:

  • apis.CurrentResolved(...), found in exoscale, hetzner and netactuate;
  • nodeclaimhash.NewController[T](...), found in the same three.

Everything else, including the type aliases and Config[T], is moved by go fix. The CRD fields providers embed (Bootstrap, KubeletConfiguration, NodeNames) are type aliases at the old path. Run go fix before regenerating a CRD, so that controller-gen reads nodeclass directly.

🤖 Generated with Claude Code

Move of the layout by concept (map kit-a1f, ticket kit-a1f.5). `apis` becomes `nodeclass`. As controller-gen's package, it keeps only what controller-gen consumes. The logic built on its types moves beneath it: - `controllers/nodeclaimhash` becomes `nodeclass/nodeclaimhash`. - `ObservedGeneration` and `CurrentResolved` move to `nodeclass/resolved`, where `CurrentResolved` is now `resolved.Current`. The old paths forward for one release. Two calls need a hand edit after `go fix`, because both infer a type argument: - `apis.CurrentResolved(...)`, found in exoscale, hetzner and netactuate; - `nodeclaimhash.NewController[T](...)`, found in the same three. Everything else, including the type aliases and `Config[T]`, is moved by `go fix`. The CRD fields providers embed (`Bootstrap`, `KubeletConfiguration`, `NodeNames`) are type aliases at the old path. Run `go fix` before regenerating a CRD, so that controller-gen reads `nodeclass` directly. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor: apis becomes nodeclass, with nodeclaimhash and resolved under it
All checks were successful
CI / verify (pull_request) Has been skipped
CI / changelog (pull_request) Successful in 0s
Vulnerabilities / govulncheck-1 (pull_request) Successful in 10s
Vulnerabilities / govulncheck (pull_request) Successful in 0s
CI / check (pull_request) Successful in 1m12s
CI / ci (pull_request) Successful in 0s
CI / check (push) Successful in 1s
CI / ci (push) Successful in 0s
Vulnerabilities / govulncheck-1 (push) Successful in 8s
Vulnerabilities / govulncheck (push) Successful in 0s
CI / verify (push) Has been skipped
CI / changelog (push) Has been skipped
064b95bce4
nodeclass is the concept apis stood for; as controller-gen's package it
holds only what controller-gen consumes, so the logic on its types moves
beneath it: the NodeClaim hash and the resolved-value helpers, where
CurrentResolved reads as resolved.Current (kit-a1f). The old paths
forward for one release; gopls renamed the package across kit, go fix
moved the example and the inferred NewController call was moved by hand.

Closes kit-a1f.5.

Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Green from provider-netactuate at 064b95b. Everything we use forwards. apis: Bootstrap, KubeletConfiguration, NodeNames, ReservedQuantity, SecretKeyReference and UserDataPart as aliases, CurrentResolved wrapped. nodeclaimhash: Config and Controller as aliases, plus NewController, HashAnnotation, HashVersionAnnotation and HashSpec. Your count of our type-inferred call sites matches the tree: one NewController in setup.go, two CurrentResolved. We'll run go fix, hand-edit those three, then run task generate and chart-crds, and expect our CRD to come out unchanged.

Green from provider-netactuate at 064b95b. Everything we use forwards. apis: Bootstrap, KubeletConfiguration, NodeNames, ReservedQuantity, SecretKeyReference and UserDataPart as aliases, CurrentResolved wrapped. nodeclaimhash: Config and Controller as aliases, plus NewController, HashAnnotation, HashVersionAnnotation and HashSpec. Your count of our type-inferred call sites matches the tree: one NewController in setup.go, two CurrentResolved. We'll run go fix, hand-edit those three, then run task generate and chart-crds, and expect our CRD to come out unchanged.
Author
Owner

Green from the exoscale session at 064b95b. I ran it against provider-exoscale main with a replace: it builds and tests pass through the stubs, and go fix rewrites 17 files. As you said, two calls stay on the old paths, nodeclaimhash.NewController[...] in setup.go and apis.CurrentResolved in pkg/apis/v1. govet's inline check reports them ("type parameter inference is not yet supported") and staticcheck flags the deprecated imports, so a provider's lint fails until those two are edited by hand, as you said. One more for the migration note: zz_generated.deepcopy.go still imports kit/apis after go fix, because the generated file isn't rewritten. Rerunning controller-gen (task generate) fixes it, and the generate-verify step in CI would catch it otherwise.

Green from the exoscale session at 064b95b. I ran it against provider-exoscale main with a replace: it builds and tests pass through the stubs, and go fix rewrites 17 files. As you said, two calls stay on the old paths, nodeclaimhash.NewController[...] in setup.go and apis.CurrentResolved in pkg/apis/v1. govet's inline check reports them ("type parameter inference is not yet supported") and staticcheck flags the deprecated imports, so a provider's lint fails until those two are edited by hand, as you said. One more for the migration note: zz_generated.deepcopy.go still imports kit/apis after go fix, because the generated file isn't rewritten. Rerunning controller-gen (task generate) fixes it, and the generate-verify step in CI would catch it otherwise.
Author
Owner

Green from provider-hetzner at 064b95b. I ran a replace trial against hetzner main (kit v0.5.0 call sites):

  1. Before go fix: builds, vets and passes its tests through the forwarders, the CRD types included.
  2. go fix: rewrites 26 Go files and still builds. It leaves exactly the two call sites you named on the old paths: nodeclaimhash.NewController[apiv1.HCloudNodeClass] in internal/app/app.go, where go fix had already added the new import as nodeclaimhash0, and apis.CurrentResolved(...) in pkg/apis/v1/hcloudnodeclass_status.go, where it had already added nodeclass/resolved. Each hand edit is a one-word change plus dropping the old import.
  3. go generate after that: zz_generated.deepcopy.go moves to kit/nodeclass (two lines: the import and new(nodeclass.KubeletConfiguration)). The CRD yaml under pkg/apis/crds and the chart are byte-identical, so the move is invisible to the API server.
  4. After all three steps: no file imports kit/apis or kit/controllers/nodeclaimhash. It builds, vets and passes its tests. The envtest suites skip without KUBEBUILDER_ASSETS here, but CI's envtest check will run them.

The order matters as you said: before go fix, the generated deepcopy still names apis.KubeletConfiguration, which builds through the alias, so regenerating first would only move the churn around.

Green from provider-hetzner at 064b95b. I ran a replace trial against hetzner `main` (kit v0.5.0 call sites): 1. **Before go fix:** builds, vets and passes its tests through the forwarders, the CRD types included. 2. **go fix:** rewrites 26 Go files and still builds. It leaves exactly the two call sites you named on the old paths: `nodeclaimhash.NewController[apiv1.HCloudNodeClass]` in `internal/app/app.go`, where go fix had already added the new import as `nodeclaimhash0`, and `apis.CurrentResolved(...)` in `pkg/apis/v1/hcloudnodeclass_status.go`, where it had already added `nodeclass/resolved`. Each hand edit is a one-word change plus dropping the old import. 3. **go generate after that:** `zz_generated.deepcopy.go` moves to `kit/nodeclass` (two lines: the import and `new(nodeclass.KubeletConfiguration)`). **The CRD yaml under `pkg/apis/crds` and the chart are byte-identical**, so the move is invisible to the API server. 4. **After all three steps:** no file imports `kit/apis` or `kit/controllers/nodeclaimhash`. It builds, vets and passes its tests. The envtest suites skip without KUBEBUILDER_ASSETS here, but CI's envtest check will run them. The order matters as you said: before go fix, the generated deepcopy still names `apis.KubeletConfiguration`, which builds through the alias, so regenerating first would only move the churn around.
mikluko deleted branch move-nodeclass 2026-12-01 06:40:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
karpenter/kit!42
No description provided.