Skip to content

🌱 reword to custom provisioner. - #2142

Open
guettli wants to merge 118 commits into
mainfrom
tg/img-url-cmd-via-go--reword-to-custome-provisioner
Open

🌱 reword to custom provisioner.#2142
guettli wants to merge 118 commits into
mainfrom
tg/img-url-cmd-via-go--reword-to-custome-provisioner

Conversation

@guettli

@guettli guettli commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Rewording to "custom provisioner".

guettli and others added 30 commits May 21, 2026 13:05
Fix gci import alignment and return err instead of nil in StateOfImageURLCommandV2 error path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add top-level Status field to ImageURLCommandOutputV2. StateOfImageURLCommandV2
now treats a missing or unparseable Status as "not done yet" (requeue) instead
of failing immediately — the binary writes output.json atomically so the file
is either complete with a valid status or absent. Also pass --api-version flag
to the binary via StartImageURLCommand's new apiVersion parameter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t.json

When the process is gone (ps check fails) but output.json is missing or
incomplete, return ImageURLCommandStateFailed right away instead of
ImageURLCommandStateRunning. This prevents waiting up to 7 minutes for the
timeout to fire when the binary crashed before writing its output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses an in-process fake SSH server so the tests run without any external
infrastructure. The two new failure-path tests would have caught the bug
fixed in the previous commit: when the process has exited but output.json
is missing or has no Status field, the old code returned
ImageURLCommandStateRunning (waiting for the 7-minute timeout) instead of
ImageURLCommandStateFailed (immediate termination).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract the decision logic into stateOfImageURLCommandV2Logic so it can
be unit-tested with plain Go values instead of a fake SSH server. The
sshClient method becomes a thin wrapper that collects SSH outputs and
delegates to the pure function. Tests drop from 212 lines (fake SSH
server + 4 integration-style tests) to 93 lines (table-driven unit
tests, no networking).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- gci: align struct field values in test table (no extra padding spaces)
- nilerr: replace `if err := json.Unmarshal(...); err != nil { return ..., nil }`
  with `_ = json.Unmarshal(...)` — bad JSON leaves Status empty, which
  already returns ImageURLCommandStateFailed on the next check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop the imageURLCommandAPIVersion field from HCloudMachineSpec and
  InstallImage (and the matching CRD YAML, validation, and docs).
- Remove the separate v2 dispatch in host.go and server.go; both now
  go through the single IMAGE_URL_DONE-based handler.
- On success, CAPH attempts to read /root/output.json. If present and
  parseable, phase conditions are updated. Missing file is not an error.
- Remove StateOfImageURLCommandV2, stateOfImageURLCommandV2Logic, and
  the dedicated v2 functions in host.go and server.go.
CAPH sets only one condition (NodeProvisioningSucceeded), not multiple
per-phase conditions. The previous wording implied otherwise.

Also fix pre-existing MD060 table separator style lint warning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The actual StepResult and PhaseResult types written by image-url-command
include duration and percentOfTimeout, but the example in the docs was
missing them, making the schema look incomplete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Restructure output.json section: lead with what CAPH reads (status,
  message), explain why JSON over plain logs, show minimal examples,
  demote extended example to its own subsection
- ParseAndApply now returns error when JSON is invalid or status field
  is missing; callers log it at StateFinishedSuccessfully so operators
  can see when output.json is present but has no status field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
guettli and others added 23 commits July 1, 2026 15:59
…redesign

output.json's status field was removed (success/failure is now decided
purely by IMAGE_URL_DONE on stdout), but two tests still expected the old
status-based abort behavior, causing a nil pointer panic since they
enforce that the CI mock is never called. A third test still expected a
hard actionError on a transient ReadOutputJSON failure, even though that
path was intentionally changed to retry via actionContinue.
# Committing as: thomas.guettler@syself.com
… publish it as event. It's not about success or not
… condition in the Kubernetes object up to date?
The test was left over from an earlier 20-minute timeout experiment
today; the code reverted to 7 minutes but the test wasn't. The
ReadOutputJSON mock is dead since the timeout check returns before
that call is ever reached.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Committing as: thomas.guettler@syself.com
@github-actions github-actions Bot added size/L Denotes a PR that changes 200-800 lines, ignoring generated files. area/code Changes made in the code directory area/api Changes made in the api directory labels Jul 3, 2026
@guettli
guettli requested a review from janiskemper July 3, 2026 12:27
@janiskemper

Copy link
Copy Markdown
Contributor

I don't think we can change the conditions etc like this.. I would not do this right now. We shouldn't do anything breaking and can do it for v1beta2

Base automatically changed from tg/img-url-cmd-via-go to main July 3, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api Changes made in the api directory area/code Changes made in the code directory size/L Denotes a PR that changes 200-800 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants