Skip to content

feat(api): add Command and Args fields to SandboxContainer#125

Merged
scotwells merged 2 commits into
feat/federated-deployment-schedulingfrom
feat/sandbox-container-command-args
May 29, 2026
Merged

feat(api): add Command and Args fields to SandboxContainer#125
scotwells merged 2 commits into
feat/federated-deployment-schedulingfrom
feat/sandbox-container-command-args

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

@scotwells scotwells commented May 29, 2026

Summary

A workload's sandbox container can now specify its own entrypoint command and arguments, overriding the defaults baked into the container image. Users get direct control over how their container starts — running a different binary, passing flags, or pointing at a different script — instead of being locked to whatever the image hardcodes. When both fields are left unset, the image's own default entrypoint and arguments are used unchanged, so existing workloads see no behavior change.

This is the API half of that capability. It adds Command []string and Args []string to SandboxContainer in api/v1alpha/instance_types.go, mirroring Kubernetes pod-spec semantics: Command overrides the image's ENTRYPOINT and Args overrides CMD, and the two can be combined. The change includes regenerated deepcopy code and CRD manifests.

These fields are intent only — the infrastructure provider reads them and passes them through to the runtime. The downstream unikraft-provider maps command/args onto the Pod it creates, completing the path from workload spec to a running container.

Test plan

  • make generate manifests runs clean; working tree unchanged after re-run
  • go build ./... and go vet ./... pass
  • make test — all packages pass
  • CRD YAML updated with command and args fields on SandboxContainer

Notes for reviewers

This PR is stacked on #107 (feat/federated-deployment-scheduling) and is consumed by a companion unikraft-provider passthrough change.

🤖 Generated with Claude Code

Exposes per-container entrypoint and argument overrides on the
SandboxContainer type, mirroring Kubernetes pod-spec semantics:

  - Command []string  — overrides the image ENTRYPOINT
  - Args    []string  — overrides the image CMD; combined with
                        Command when both are set

When neither field is set the image's own ENTRYPOINT/CMD are used
unchanged, which is the correct default for standard OCI images
(e.g. hello-world, nginx).  Infrastructure providers that translate
Instance specs (such as unikraft-provider) should map these fields
through to the underlying runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scotwells added a commit to datum-cloud/unikraft-provider that referenced this pull request May 29, 2026
…spec

The provider was unconditionally setting `spec.Args = ["/usr/bin/bun run
/usr/src/server.ts"]` for every sandbox container.  Any unikernel image
that does not ship /usr/bin/bun would hit a UKC boot assertion and crash.

Changes in this commit
  - Remove the hardcode.
  - Add mapContainerArgs (instance_mapper.go): maps SandboxContainer.Command
    and .Args → UKC CreateInstanceRequest.Args using Kubernetes semantics:
      * command + args → append(command, args...)
      * command only  → command
      * args only     → args
      * neither       → nil (UKC uses image's own built-in default args)
  - Update instance_controller.go to call mapContainerArgs and migrate to the
    updated multicluster-runtime/milo API (ClusterName typed string,
    TypedEventHandlerFunc, ProviderRunnable.Start).
  - Add instance_mapper_test.go: unit tests covering all four mapping cases,
    full buildUnikraftSpecFromContainer passthrough (env, ports, memory),
    datum/bun reference image, hello-world no-args, and template annotation.
  - Update examples/instance.yaml with a comment showing command/args are
    optional for the datum/bun image (its default args are baked in).
  - Bump go.datum.net/compute via replace directive (local path) to pick up
    the new SandboxContainer.Command and .Args fields added in
    datum-cloud/compute#125.  Replace the directive with a real version pin
    once that PR is tagged.

The datum/bun unikernel image bakes its default command into the image's
own UKC metadata (Image.Args), so it continues to run without specifying
Command/Args in the workload spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scotwells scotwells changed the base branch from main to feat/federated-deployment-scheduling May 29, 2026 11:58
…stant

Four occurrences in instance_writeback_test.go triggered goconst because
testInstanceType = "d1-standard-2" already exists in the same package.
Replacing all four with the constant keeps golangci-lint at 0 issues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scotwells scotwells merged commit fa711b9 into feat/federated-deployment-scheduling May 29, 2026
9 checks passed
@scotwells scotwells deleted the feat/sandbox-container-command-args branch May 29, 2026 12:21
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.

1 participant