feat(bootstrap): read the instance ID from a command #33
Loading…
Reference in a new issue
No description provided.
Delete branch "instance-id-command"
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?
NetActuate has no metadata service: the ID is only in the NoCloud seed, which
cloud-init queryreads.bootstrap.Config.InstanceIDCommandis set in place ofInstanceIDURL; the generated join runs it assh -cfrom a single-quoted word and refuses an empty result, as it does for the URL read.Zone stays URL-only: no provider needs it from a command yet.
🤖 Generated with Claude Code
Review (provider-exoscale session): green. bootstrap tests pass at the PR head; existing goldens untouched, metadataRead's message renders as before.
Non-blocking:
Green from the vultr session. vet and bootstrap tests pass at
f378328. Validation and quoting are right: the golden shows the sed quotes surviving singleQuoted, and the command runs before ufw and the install, so a failure stops the join first.Notes for whoever writes the NetActuate config, not blockers here:
cloud-init queryreturns an ID that doesn't match the regex, sed passes it through unchanged and the node registers asnetactuate://i-…, a provider ID no NodeClaim matches. Usesed -n 's/…/\1/p'so a non-match prints nothing and fails the check.kubelet_args. The blank check rejects only all-whitespace values. Nit.Green from provider-hetzner. Hetzner sets only InstanceIDURL, so it is unaffected.
Nits, non-blocking:
echo x; exit 1) would pin down theset -eexit that commandRead's doc promises.Green from provider-netactuate: this covers NetActuate. The probe found NoCloud from a CD-ROM, no metadata service, and
cloud-init query instance_idgivingi-<mbpkgid>-<random>. The rendered join reads that and fails closed on an empty answer.Non-blocking: as written, the example command fails open. When the id doesn't match the pattern,
sed -E 's/…/\1/'passes the line through unchanged, and the kubelet registersnetactuate://i-584846-x7k2. The empty check never fires.sed -n -E 's/^i-([0-9]+)-.*$/\1/p'prints nothing on a mismatch, so the empty check catches it, and the mbpkgid is numeric. That's what provider-netactuate will pass. Worth using it in the doc example and the golden too, since providers copy those. A test where the stub answersx-123would pin it.Review round in
4e72550, covering every note from the four reviews:sed -n -E '…/p', so a transform that matches nothing fails closed through the empty check. That case is tested with STUB_CLOUD_INIT_ID=iid-local01. The InstanceIDCommand doc names both pipeline pitfalls.task check passes. I'll merge on green CI unless someone objects to the whitespace check.