refactor: apis becomes nodeclass, with nodeclaimhash and resolved under it #42
Loading…
Reference in a new issue
No description provided.
Delete branch "move-nodeclass"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Move of the layout by concept (map kit-a1f, ticket kit-a1f.5).
apisbecomesnodeclass. As controller-gen's package, it keeps only what controller-gen consumes. The logic built on its types moves beneath it:controllers/nodeclaimhashbecomesnodeclass/nodeclaimhash.ObservedGenerationandCurrentResolvedmove tonodeclass/resolved, whereCurrentResolvedis nowresolved.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 bygo fix. The CRD fields providers embed (Bootstrap,KubeletConfiguration,NodeNames) are type aliases at the old path. Rungo fixbefore regenerating a CRD, so that controller-gen readsnodeclassdirectly.🤖 Generated with Claude Code
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 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 provider-hetzner at
064b95b. I ran a replace trial against hetznermain(kit v0.5.0 call sites):nodeclaimhash.NewController[apiv1.HCloudNodeClass]ininternal/app/app.go, where go fix had already added the new import asnodeclaimhash0, andapis.CurrentResolved(...)inpkg/apis/v1/hcloudnodeclass_status.go, where it had already addednodeclass/resolved. Each hand edit is a one-word change plus dropping the old import.zz_generated.deepcopy.gomoves tokit/nodeclass(two lines: the import andnew(nodeclass.KubeletConfiguration)). The CRD yaml underpkg/apis/crdsand the chart are byte-identical, so the move is invisible to the API server.kit/apisorkit/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.