Skip to content

feat(fc): Firecracker zero-YAML CLI flags, then rename provider firecracker → fc - #919

Merged
cdalar merged 4 commits into
mainfrom
firecracker-flags-no-yaml
Jun 19, 2026
Merged

cdalar merged 4 commits into
mainfrom
firecracker-flags-no-yaml

Conversation

@cdalar

@cdalar cdalar commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Two related changes for the local Firecracker provider, in two commits:

  1. feat(create) — bring Firecracker to parity with the Hetzner zero-YAML pass (feat(create): expose Hetzner config as CLI flags; drop required .onctl YAML #918): every firecracker.yaml setting is now a CLI flag with a default, so the provider works with no .onctl config.
  2. refactor — rename the provider identity from firecracker to fc (string, config keys, package, types, filenames), while keeping every reference to the Firecracker technology/binary intact.

Commit 1 — Firecracker CLI flags; drop firecracker.yaml

  • setDefaults(): defaults for the firecracker.* keys (kernelImage, rootfsImage, vcpuCount, memSizeMib, binPath, network.bridge/cidr, vm.username) matching the old YAML. GetConfig already defaulted most of these for direct package use; kernelImage/rootfsImage (previously empty) now resolve to the conventional ~/.onctl/firecracker/images/... paths with no config.
  • New create flags bound to the keys the code already reads: --kernel-image, --rootfs-image, --fc-binary, --vcpu, --memory. The generic --username also drives the microVM user.
  • Removed embedded internal/files/init/firecracker.yaml (onctl init no longer scaffolds it).
  • flags_defaults_test.go covers the new flags' existence, viper binding, and defaults.

Commit 2 — rename provider firecracker → fc

  • Provider string: --provider fc, ONCTL_CLOUD=fc, cloudProviderList entry.
  • Config keys: firecracker.* → fc.* (e.g. fc.kernelImage, fc.vcpuCount, fc.network.bridge, fc.vm.username).
  • Package internal/providerfirecracker → internal/providerfc.
  • Exported types: ProviderFirecracker→ProviderFC, FirecrackerConfig→FCConfig, FirecrackerVMConfig→FCVMConfig, FirecrackerProcess→FCProcess, FirecrackerAPI→FCAPI (plus unexported helpers and test funcs).
  • Files pkg/cloud/firecracker.go → fc.go, firecracker_test.go → fc_test.go.
  • README provider name + ONCTL_CLOUD updated.

Deliberately kept (these name the Firecracker technology, not the provider)

  • the literal firecracker binary name (fc.binPath default);
  • the ~/.onctl/firecracker image/state directory paths, so existing image layouts keep working;
  • comments/strings describing the Firecracker API, VMM and microVMs;
  • the firecracker/firecracker-host-setup.sh template path in the README.

Breaking changes

Renaming the provider identity is breaking for existing Firecracker users:

  • --provider firecracker / ONCTL_CLOUD=firecracker → fc
  • firecracker: config block → fc: (note: onctl init no longer writes this file; defaults cover it)

Tests

go build ./..., go vet ./..., go test ./... all green; gofmt clean. onctl create --help shows the new flags; onctl init no longer scaffolds a firecracker/fc YAML.

🤖 Generated with Claude Code

cdalar and others added 3 commits June 19, 2026 14:21
…r.yaml

Mirrors the Hetzner pass (#918) for Firecracker so the provider works with no
.onctl YAML:

- setDefaults(): firecracker.* defaults (kernelImage, rootfsImage, vcpuCount,
  memSizeMib, binPath, network.bridge/cidr, vm.username) matching the old
  firecracker.yaml. providerfirecracker.GetConfig still defaults these for
  direct package use; kernelImage/rootfsImage (which GetConfig left empty) now
  resolve to the conventional ~/.onctl paths with no config.
- create flags --kernel-image, --rootfs-image, --fc-binary, --vcpu, --memory
  bound to the firecracker.* keys read by GetConfig; the generic --username
  also drives firecracker.vm.username.
- Removed embedded internal/files/init/firecracker.yaml (`onctl init` no longer
  scaffolds it).
- flags_defaults_test.go covers the new flags' existence, viper binding, and
  defaults.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha7EmqjjYwGC3f1wk41TE2
Renames the provider *identity* from `firecracker` to `fc` while keeping every
reference to the Firecracker technology/binary intact:

- Provider string: `--provider fc`, `ONCTL_CLOUD=fc`, cloudProviderList entry.
- Config keys: firecracker.* -> fc.* (e.g. fc.kernelImage, fc.vcpuCount,
  fc.network.bridge, fc.vm.username).
- Package internal/providerfirecracker -> internal/providerfc.
- Exported Go types: ProviderFirecracker->ProviderFC, FirecrackerConfig->FCConfig,
  FirecrackerVMConfig->FCVMConfig, FirecrackerProcess->FCProcess,
  FirecrackerAPI->FCAPI (plus unexported helpers: firecrackerRequest->fcRequest,
  firecrackerStatus*->fcStatus*, defaultFirecrackerKernelArgs->defaultFCKernelArgs,
  firecrackerMAC/TapName/VM, parseFirecrackerType, load/saveFirecrackerMetadata,
  allocateFirecrackerIP, and the test helpers).
- Files pkg/cloud/firecracker.go -> fc.go, firecracker_test.go -> fc_test.go.
- README provider name + ONCTL_CLOUD updated.

Deliberately KEPT (these name the Firecracker technology, not the provider):
- the literal `firecracker` binary name (fc.binPath default),
- the ~/.onctl/firecracker image/state directory paths (so existing image
  layouts keep working),
- comments/strings describing the Firecracker API, VMM and microVMs,
- the firecracker/firecracker-host-setup.sh template path in the README.

go build / go vet / go test ./... all green; gofmt clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha7EmqjjYwGC3f1wk41TE2
Walkthrough for testing this branch on a GCP fc-host VM: building/copying the
binary, running create/pause/resume/destroy against the new `fc` provider and
flags, and confirming the old `firecracker` provider name is rejected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha7EmqjjYwGC3f1wk41TE2
@codecov

codecov Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.54545% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.81%. Comparing base (f665f23) to head (d857ba5).

Files with missing lines Patch % Lines
cmd/root.go 0.00% 8 Missing ⚠️
pkg/cloud/fc.go 86.20% 4 Missing and 4 partials ⚠️
cmd/create.go 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #919      +/-   ##
==========================================
+ Coverage   22.41%   22.81%   +0.40%     
==========================================
  Files          42       42              
  Lines        4163     4182      +19     
==========================================
+ Hits          933      954      +21     
+ Misses       3114     3113       -1     
+ Partials      116      115       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c95d4d5f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/root.go Resolved
initState only let the hetzner provider skip a missing/unreadable
config file. The fc provider now ships built-in defaults too (this
PR), so it needs the same configless path or fresh `ONCTL_CLOUD=fc`
runs abort before defaults/flags are applied.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gf7TpG2y985TySw8Pg7Cn3
@cdalar
cdalar merged commit 7c94b0e into main Jun 19, 2026
17 checks passed
@cdalar
cdalar deleted the firecracker-flags-no-yaml branch August 19, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址