Skip to content

✨ feat(contributor): opt-in krun OCI runtime for the contributor container - #12262

Merged
hivecommons-hive[bot] merged 2 commits into
v6from
scanner/fix-12199
Oct 16, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v6from
scanner/fix-12199

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Opt-in krun microVM mode for the contributor container. HIVE_CONTAINER_OCI_RUNTIME=krun (environment or contributor.env) runs just contribute-hive / just contribute-standby under rootless podman with --runtime krun, headless only. It fails closed and never falls back to a plain container. When the variable is unset or empty, the launch is byte-for-byte unchanged (checked against goldens).

Closes #12199.
Refs #12197 (parent tracker; remaining children #12200, #12202 stay open).

Requirement mapping

  • A1 The variable is read as a shell variable after contributor.env is sourced, so a value set only in that file still counts. Unset or empty skips every krun branch.
  • A2 Only krun is accepted. The refusal names the accepted value and says Kata is not supported because it does not run under podman.
  • A3 krun selects podman before the docker-first detection, which is unchanged. It refuses HIVE_CONTAINER_RUNTIME=docker, a missing podman, and rootful podman (.Host.Security.Rootless).
  • A4 It refuses local mode and any non-headless mode (pointing to 🌱 contributor krun mode: interactive sessions (omp) through the VM console #12202). In krun mode the recipe prints no exec -it attach command.
  • A5 It refuses pi (needs host networking) and any backend missing from the relay's HEADLESS_BACKENDS, which is read from bin/contributor-relay.js.
  • A6 It refuses macOS (uname -s).
  • A7 Preflight checks: podman --runtime=krun info, an open of /dev/kvm read-write (path overridable for tests via HIVE_KRUN_KVM_DEVICE), and a fresh smoke run (--memory 1g --memory-swap 1g --cpus 1, krun.cpus=1, krun.ram_mib=768, --entrypoint sh). The smoke run must report a guest kernel different from the host's and the /.krun_config.json marker. Each failure names the check and exits before the contributor starts.
  • A8 The contributor launch uses the same flags as the podman launch, plus --runtime krun and the krun annotations. A test compares the two argvs after stripping those.
  • A9 krun.ram_mib is 75% of HIVE_CONTAINER_MEMORY, rounded down (4g gives 3072). krun.cpus is ceil(HIVE_CONTAINER_CPUS) clamped to 1..16. none/0 sets nothing. A non-numeric CPU value is refused.
  • A10 The banner gains an Isolation: microVM (krun) line with guest kernel, memory and vCPUs, noting when krun's defaults apply. It warns about nested hosts based on systemd-detect-virt --vm.
  • A11 A krun OOM-kill is reported as VM memory. A krun exit 137 without an OOM report is reported as a stop. contribute-stop removes the contributor containers podman reports ran under .OCIRuntime == krun and deletes contributor-relay.pid. hivectl relay controls refuse krun containers.
  • A12 Docs: a hardened-mode section in contributor-relay.md, an env-var row, a sandbox-isolation.md summary, a krun sentence added to every "no microVM" statement, and the corrected podman-rootless-ci.md sentence. Changelog fragment: changelog.d/added-contributor-krun-mode.md.

Tests (run by CI only; nothing was run locally)

  • src/deploy/test_contributor_container_resources.sh is extended with:
    • docker and podman goldens (src/deploy/testdata/contributor_run_*.golden) for unset and empty;
    • every A-AC2 refusal and A-AC4 preflight failure, each asserting that no container started;
    • podman-vs-docker selection, VM sizing, banner, nested warning and the contributor.env-only opt-in;
    • OOM and exit-137 diagnostics, and contribute-stop.
  • relay_control_test.go covers krun refusal through a stubbed runtime command.

The golden files were written by hand from the recipe. If CI shows a diff against them, that is the first thing to check.

The end-to-end run on bare-metal KVM hardware happens after merge, per the issue.

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@Danathar

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <scanner@hive.kubestellar.io>
Co-authored-by: Danathar <6772335+Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 16, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@github-actions github-actions Bot added conflicts-with-open-pr Open PR has a merge conflict with another open PR and removed conflicts-with-open-pr Open PR has a merge conflict with another open PR labels Oct 16, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: merged origin/v6 into the branch and resolved the Justfile conflict (krun no-attach branch now precedes v6's new CONTRIBUTOR_MODE=headless check). CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Signed-off-by: scanner <scanner@hive.kubestellar.io>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
0b7fe7b

ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blocked

Hive flagged this PR (author @hivecommons-hive[bot], head 0b7fe7b688c8) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 4 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • Justfile
    • src/deploy/test_contributor_container_resources.sh
    • src/deploy/testdata/contributor_run_docker.golden
    • src/deploy/testdata/contributor_run_podman.golden
  • ci_gate_weakening — CI configuration is deleted, softened or has gate checks removed (Disables or softens CI gates (continue-on-error, || true, removed checks))
    • Justfile

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@hivecommons-hive
hivecommons-hive Bot merged commit 0643a10 into v6 Oct 16, 2026
65 of 66 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#122620b7fe7b` sha256:f5f44d15666b71f49cbd2f6af712fff70c6d476c1f48d808374bf6c8980d790e — download from the dashboard or `hivectl review evidence #12262`.

@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-12199 branch October 16, 2026 03:30
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌱 contributor krun mode: opt-in HIVE_CONTAINER_OCI_RUNTIME=krun launch, fail closed, headless only

0 participants