feat: worked provider example; cloudprovider fixes for adoption and token cleanup #28

Merged
mikluko merged 3 commits from example into main 2026-11-28 13:24:17 +00:00
Owner

Two parts, one PR so Exoscale can build on both at once.

cloudprovider fixes (vultr's review of #25):

  • HydrateAt(nodeClaim, instanceTypes, Placement) labels an adopted instance from its real type and zone (identity labels + the instance's capacity when the type left the catalogue); Hydrate's doc says it takes the candidate Launch returned.
  • Breaking for adopters (pre-0.1.0): the try returns (T, cleanup, error); Launch runs the cleanup on a detached context for any attempt whose error wraps ErrNoInstance, so a minted join token isn't leaked across refused attempts.
  • ErrNoInstance marks every Refused error and the nothing-launched error.
  • Refused's doc: quota, network or image failures must not be wrapped in it. RepairPolicies' doc reworded. Tests for reason funcs through Launch + CreateError and Hydrate with NotIn/Exists/multi-valued requirements.

internal/example: a provider written on kit against a fake cloud, to copy from (internal so the fake can't be imported): fakecloud.go (the one file a real provider replaces with its API client), node class embedding kit/apis, catalogue Source, orphan Instances, a CloudProvider using the helpers + Launcher + Joiner + nodename + ownership + providerid + typename, and Setup/Run wiring the controllers. Tests: cheapest launch, refusal fall-through, all refused, quota, adopt on retry, Get/List/Delete, drift, GetInstanceTypes.

🤖 Generated with Claude Code

Two parts, one PR so Exoscale can build on both at once. **cloudprovider fixes** (vultr's review of #25): - `HydrateAt(nodeClaim, instanceTypes, Placement)` labels an adopted instance from its real type and zone (identity labels + the instance's capacity when the type left the catalogue); `Hydrate`'s doc says it takes the candidate Launch returned. - Breaking for adopters (pre-0.1.0): the try returns `(T, cleanup, error)`; Launch runs the cleanup on a detached context for any attempt whose error wraps `ErrNoInstance`, so a minted join token isn't leaked across refused attempts. - `ErrNoInstance` marks every Refused error and the nothing-launched error. - Refused's doc: quota, network or image failures must not be wrapped in it. RepairPolicies' doc reworded. Tests for reason funcs through Launch + CreateError and Hydrate with NotIn/Exists/multi-valued requirements. **internal/example**: a provider written on kit against a fake cloud, to copy from (internal so the fake can't be imported): fakecloud.go (the one file a real provider replaces with its API client), node class embedding kit/apis, catalogue Source, orphan Instances, a CloudProvider using the helpers + Launcher + Joiner + nodename + ownership + providerid + typename, and Setup/Run wiring the controllers. Tests: cheapest launch, refusal fall-through, all refused, quota, adopt on retry, Get/List/Delete, drift, GetInstanceTypes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: worked provider example; cloudprovider fixes for adoption and token cleanup
Some checks failed
CI / verify (pull_request) Has been skipped
CI / changelog (pull_request) Successful in 2s
Vulnerabilities / govulncheck-1 (pull_request) Failing after 5s
Vulnerabilities / govulncheck (pull_request) Failing after 0s
CI / check (pull_request) Successful in 1m17s
CI / ci (pull_request) Successful in 0s
041e4d8df9
Assisted-By: Claude <noreply@anthropic.com>
fix(cloudprovider,example): review round on Launch, HydrateAt and the example
Some checks failed
CI / verify (pull_request) Has been skipped
CI / check (pull_request) Successful in 7s
CI / changelog (pull_request) Successful in 3s
CI / ci (pull_request) Successful in 0s
Vulnerabilities / govulncheck-1 (pull_request) Failing after 21s
Vulnerabilities / govulncheck (pull_request) Failing after 0s
68557b19c8
Launch keeps running a cleanup only for attempts that wrap ErrNoInstance:
an attempt that may have created an instance keeps its token, because the
next Create adopts that instance and it boots with the token in its user
data. Panics in a try become the attempt's error; panics in a cleanup are
logged. A panicking try returns no cleanup, so it has none to run.

HydrateAt returns an error (ErrNoInstanceType for an empty type) and its
Placement carries Architecture, extra Labels and Allocatable, so an
instance whose type left the catalogue gets arch and the overhead the
provider computes. An offering that names no capacity type matches.

The example carries the image to status.imageID, passes the instance's
capacity type, refuses a plan no longer sold, keeps List going past a
plan typename refuses, takes MaxAttempts as an option, and its fake cloud
can lag its list.

Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(cloudprovider): Launch is a function, not a generic method
All checks were successful
CI / verify (pull_request) Has been skipped
CI / check (pull_request) Successful in 7s
CI / changelog (pull_request) Successful in 4s
CI / ci (pull_request) Successful in 0s
Vulnerabilities / govulncheck-1 (pull_request) Successful in 43s
Vulnerabilities / govulncheck (pull_request) Successful in 0s
e7f37600b1
govulncheck (x/tools typesinternal.ForEachElement in ssa RuntimeTypes)
panics on an instantiated generic method, so every provider calling
Launcher.Launch crashed its scan. Launcher stays as the configuration.

Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mikluko deleted branch example 2026-11-28 13:24:17 +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!28
No description provided.