Skip to content

feat(cli): add ax local, ax install/uninstall, and one-line installer - #603

Merged
YoyinZyc merged 2 commits into
google:mainfrom
YoyinZyc:pr1/local-installer
Nov 16, 2026
Merged

YoyinZyc merged 2 commits into
google:mainfrom
YoyinZyc:pr1/local-installer

Conversation

@YoyinZyc

@YoyinZyc YoyinZyc commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a self-contained CLI installer and local/remote cluster lifecycle commands so developers can install ax in one command, bootstrap a local Kubernetes + Agent Substrate v1.0.0 + AX sandbox stack without cloning upstream repositories, and deploy or upgrade AX on remote Kubernetes clusters (e.g., GKE):

  • One-line CLI installer (install.sh): Auto-detects darwin/linux and amd64/arm64, verifies SHA-256 checksums, and installs ax into ~/.ax/bin without requiring sudo (surfacing Colima / OrbStack / Docker Desktop setup guidance on macOS when no container engine is running).
  • ax local <start|status|stop|delete>: Bootstraps a self-contained Kubernetes v1.36.1 Kind cluster, Agent Substrate v1.0.0 (pure-Go Ed25519/ECDSA-P256 CA & ES256 JWK pool generation, mTLS PostgreSQL role setup, rustfs, k8s-credential-provider, and a gVisor WorkerPool), and AX — auto-downloading pinned kind v0.32.0 and kubectl v1.36.0 into ~/.ax/bin/ on demand. Includes fail-fast container host/VM preflight validation (rootful mode, Linux kernel >= 6.8 for OverlayFS lowerdir+, and RAM thresholds) across Linux and macOS.
  • ax install / ax uninstall: install and deploy ax on the kind cluster
  • **ax ctx [name] ** : Lists kubeconfig contexts with live AX tunnel health, switches the active context

For the full end-to-end user journey (one-line install -> local sandbox & snapshot lifecycle -> unchanged deployment & GCS snapshot verification on GKE -> cleanup), see docs/local_installer.md.

The installer follows a three-layer architecture (cluster -> substrate -> axdeploy):

Three-layer installer architecture

Tested

  1. Walkthrough the docs/local_installer.md (One-line release install ) on both linux and mac.
  2. Tested the release and running the unit tests on macos-arm64. https://github.com/YoyinZyc/ax/actions/runs/43767656230

Next PRs

  • ax push: for local to remote continuity
  • ax studio: install the ax CLI with the above install.sh, and then run "ax studio" to start the local web app
  • add release pipeline for install.sh; replace the private image once ax official image is ready.

Dependency Gaps, Trade-offs & Temporary Code

Several parts of internal/install/ exist solely to bridge current packaging gaps in upstream dependencies. They are intentionally isolated behind narrow package boundaries so they can be deleted cleanly once those gaps close:

Current Dependency Gap Pragmatic Trade-off in This PR Temporary Code to Delete Later
1. Agent Substrate has no Helm chart yet
Upstream currently distributes Kustomize overlays + ate-setup (requiring a Substrate git checkout, ko, and openssl).
- For ax local: Embed deterministic, digest-pinned Substrate v1.0.0 manifests (synced via hack/sync-substrate-manifests.sh and verified against go.mod by TestEmbeddedManifestsMatchGoModVersion) and generate local CA/JWT pools + Postgres mTLS roles in pure Go.
- For ax install: Reconcile Substrate caller allowlists in place on ate-system Deployments and k8s-credential-provider-namespace-policy (kubectl patch --type=merge).
Once Substrate ships an official Helm chart:
- Delete internal/install/substrate/manifests/*.yaml (~5,490 lines) and hack/sync-substrate-manifests.sh, replacing internal/install/substrate/bootstrap.go with a thin Helm chart install.
- Simplify/remove internal/install/axdeploy/authz.go once caller allowlists are exposed declaratively.
2. Official ghcr.io/google/ax/* & prebuilt agent release images are not published by CI yet
Meanwhile, Substrate strictly requires @sha256-pinned task images, and local Apple Silicon Macs (linux/arm64) + cloud GKE nodes (linux/amd64) need multi-arch OCI Image Indexes.
- Expose independent --server-image and --default-task-image flags (since prebuilt agent images may live in a separate registry/org on an independent release cadence) and resolve tags to @sha256 digests via crane.Digest.
- Default temporarily to public multi-arch (linux/amd64 + linux/arm64) staging images built with hack/publish-multiarch-images.sh (marked with explicit TODO(release) comments).
Once official multi-arch release workflows publish ax-server and prebuilt agent images:
- Switch axdeploy.DefaultServerImage and axdeploy.DefaultTaskImage in internal/install/axdeploy/deploy.go from the staging repo to the official release registry paths and tags.
3. AX manifests are raw YAML (deploy/*.yaml) rather than a chart deploy/embed.go embeds deploy/postgres.yaml and deploy/ax-server.yaml as the single source of truth and rewrites namespaces/image placeholders in Go (verified by multi-doc YAML tests in deploy/embed_test.go). Replace deploy/embed.go string rendering if AX adopts a Helm chart.

go.mod change: Promotes github.com/google/go-containerregistry v0.21.7 (already in the dependency graph via Substrate) to a direct dependency for OCI digest resolution and Docker keychain authentication.

Reviewer tip: Over half of the line count in this PR (internal/install/substrate/manifests/01..08-*.yaml, ~5,490 lines) is deterministically exported from go.ate.dev/substrate v1.0.0 by ./hack/sync-substrate-manifests.sh and guarded by TestEmbeddedManifestsMatchGoModVersion — you can safely collapse those 8 YAML files during review.


Part of #543

)

const (
// DefaultServerImage is the default ax-server container image when

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@MushuEE let me know whenever the official registry ready, l will do a quick swap. Thanks :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ack, will do!

@mayawang

Copy link
Copy Markdown
Collaborator

Really nice work, the key handling and stdin-for-secrets are great. A few things I'd like fixed before merge, since this is the first thing new users run:

  1. kind and kubectl downloads aren't checksum-verified (tools.go), and they then take priority over PATH. Both publish .sha256 files, could we pin and check them?
  2. The default images are ghcr.io/yoyinzyc/...:latest, resolved at install time, so nothing is really pinned and they depend on a personal account. Could they move to agentexecutor (or wherever Luke's images live) with pinned digests?
  3. set-context local overwrites an existing context named local, and delete removes it unconditionally. Could we use a less common name (ax-local?) and only delete what we created?
  4. chmod 666 /dev/kvm in the kind node looks like it changes the host's /dev/kvm through the bind mount. Can we avoid that, or at least say so?

Happy for these to be follow-ups: install.sh checksums coming from the same origin (signing), the release pipeline it depends on, and splitting out the ax ctx/tunnel rework. Also worth checking that #602 can plug in behind the Provider interface rather than being hardwired to kind.

Add self-contained local environment management (ax local start/status/stop/delete), cluster installation/upgrade/teardown (ax install, ax uninstall), and root install.sh.

- internal/install/executil: auto-download kind v0.32.0 and kubectl v1.36.0 into ~/.ax/bin and preflight container host/VM Linux kernel (>= 6.8), rootful mode, and memory (>= 4 GiB) on Linux and macOS.
- internal/install/cluster: create, start, stop, inspect, and delete Kubernetes 1.36.1 Kind clusters with Kubelet parallel image pulls and worker net.ipv4.conf.all.proxy_arp=1.
- internal/install/substrate: pure-Go PKI (Ed25519/ECDSA P-256 CAs with non-empty random CN, server/client mTLS certs, ES256 JWKS) and version-pinned Agent Substrate v1.0.0 bootstrap + gVisor WorkerPool.
- internal/install/axdeploy + deploy/embed.go: crane-based multi-arch OCI digest resolution for independent --server-image and --default-task-image flags, idempotent Substrate caller authorization (ate-api-server, atenet-router, k8s-credential-provider label-scoped to ax.io/credential=true), and embedded AX deployment rendering.
- internal/tunnel: isolate cached router mTLS certs by cluster fingerprint and harden background port-forward reconnects.
- install.sh: SHA256-verified darwin/linux amd64/arm64 CLI installer.

Closes google#526
@YoyinZyc
YoyinZyc force-pushed the pr1/local-installer branch from febfe05 to cd3c505 Compare November 16, 2026 20:45
@YoyinZyc

YoyinZyc commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thank you @mayawang for the comments. Replied inline:

kind and kubectl downloads aren't checksum-verified (tools.go), and they then take priority over PATH. Both publish .sha256 files, could we pin and check them?

Done in internal/install/executil/tools.go

The default images are ghcr.io/yoyinzyc/...:latest, resolved at install time, so nothing is really pinned and they depend on a personal account. Could they move to agentexecutor (or wherever Luke's images live) with pinned digests?

The official images are not ready and I will update here once they are ready. And I removed my personal ones, and added a flag/env to pass in the server image to test.

set-context local overwrites an existing context named local, and delete removes it unconditionally. Could we use a less common name (ax-local?) and only delete what we created?

Good catch, changed the default name and only delete the ones we created

chmod 666 /dev/kvm in the kind node looks like it changes the host's /dev/kvm through the bind mount. Can we avoid that, or at least say so?

It was originally from the hack script. Yeah just dropped /dev/kvm bind-mount and chmod 666

Also worth checking that #602 can plug in behind the Provider interface rather than being hardwired to kind.

we could add another backend interface to make it k8s agnostic, but since substrate is still mostly running on k8s, I also agree we could do it later.

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the quick turnaround, all four look good. LGTM. Note for the demo: until Grant's release images land, ax local start needs --server-image/--default-task-image, so Step 1 of the hero demo will need those too.

@YoyinZyc
YoyinZyc merged commit 9003bbd into google:main Nov 16, 2026
10 checks passed
MushuEE added a commit that referenced this pull request Nov 17, 2026
* ci: build and publish a release when a vX.Y.Z tag is pushed

Pushing a release tag now builds ax-server and ax-task-runner for
linux/amd64 and linux/arm64 and pushes them to ghcr.io/google/ax, then
publishes the GitHub release with the ax CLI (linux/darwin, amd64/arm64,
with sha256 files), ax-server.yaml rendered with both images pinned by
digest, and postgres.yaml. Pre-release tags publish pre-releases.

Pull requests that touch the release run it as a dry run against a
registry inside the job. ax version now prints the release version.

* release: publish ghcr.io/google/ax image refs and installer-compatible archives

Add internal/version (Version, ImageRepo, Image) so code that deploys AX,
such as ax install in #603, can default to the images of its own release,
or :latest for dev builds. The highest stable release now moves :latest.

Ship the CLI as ax_<os>_<arch>.tar.gz with checksums.txt, and attach
install.sh when the tag has one, matching what install.sh downloads.

* release: align with the build and release epic (#609)

Key concurrency by tag, dry-run on any Dockerfile.* change, fail the
existence check on registry errors instead of rebuilding, refuse
Dockerfiles that pin TARGETARCH, verify each platform image holds the
right binary, and write digests to the job summary. Export task_image
for stage 2 agent images and point the docs at #609 and #610.

* release: drop the agent image hook; agent images are built in agentexecutor/images

* release: address review of #616

- Never rebuild over a published tag on a registry error: the second
  inspect call fails closed, stderr is kept out of the manifest, and
  ghcr.io's DENIED for a never-pushed package is resolved through the
  packages API instead of failing the first release.
- Rebuild only missing or incomplete images, and nothing at all once the
  release is published; read the release state fail-closed.
- Refuse tags that are not on main or a release-* branch.
- Publish a leftover draft with this run's assets and notes instead of
  leaving it stale; upload only known assets.
- Refetch tags before moving :latest so an older release cannot take it
  back.
- Dry runs cover go.mod, install.sh, cmd and internal/version changes,
  and rerun the image step to check that it reuses the same digests.
- Reproducible CLI archives (fixed mtime, gzip -n); index annotations so
  GHCR links multi-arch packages; docs for older tags and prerequisites.

* release: publish ax-runner-volume and render AX_RUNNER_VOLUME_IMAGE

main added Dockerfile.runner-volume (#619) and an AX_RUNNER_VOLUME_IMAGE
placeholder to deploy/ax-server.yaml (#620), which failed the render
step's leftover-placeholder check.

Releases now also publish ghcr.io/google/ax/ax-runner-volume (multi-arch,
binary checked per platform) and list its digest in the notes. The
rendered manifest leaves AX_RUNNER_VOLUME_IMAGE empty, the same default
as the Makefile, so tasks keep running the runner baked into their image
until an operator opts in.

* release: don't publish ax-runner-volume yet

The runner volume work (#619, #620) is not ready, so releases no longer
build or publish ax-runner-volume. The rendered ax-server.yaml still
fills the AX_RUNNER_VOLUME_IMAGE placeholder with an empty value, so
tasks run the runner baked into their image and the render step's
leftover-placeholder check passes.
ghchinoy added a commit to ghchinoy/ax-central that referenced this pull request Nov 18, 2026
ghchinoy added a commit to ghchinoy/ax that referenced this pull request Nov 18, 2026
ghchinoy added a commit to ghchinoy/ax-central that referenced this pull request Nov 21, 2026
… install preflight

Wrap upstream ax install / ax uninstall (google/ax#603) for non-Kind
kubeconfig contexts. A read-only preflight checks Kubernetes 1.36+
(1.37+ recommended), the PodCertificateRequest and ClusterTrustBundle
APIs, an installed Agent Substrate, a WorkerPool, the ax-server image,
and ax CLI install support before streaming ax install to the Output
console. Substrate v1.0 runs gVisor in its WorkerPool pods, so no
RuntimeClass check is needed. Adds the preflight_cluster_install WebMCP
tool.

Refs ax-central-00k.2
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.

3 participants