Repository navigation
feat(cli): add ax local, ax install/uninstall, and one-line installer - #603
Conversation
9e3555d to
febfe05
Compare
| ) | ||
|
|
||
| const ( | ||
| // DefaultServerImage is the default ax-server container image when |
There was a problem hiding this comment.
@MushuEE let me know whenever the official registry ready, l will do a quick swap. Thanks :)
|
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:
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
febfe05 to
cd3c505
Compare
|
Thank you @mayawang for the comments. Replied inline:
Done in
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.
Good catch, changed the default name and only delete the ones we created
It was originally from the hack script. Yeah just dropped /dev/kvm bind-mount and chmod 666
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
left a comment
There was a problem hiding this comment.
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.
* 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.
…ontext, and ~/.ax/bin with google/ax#603-#642
… 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
Summary
This PR adds a self-contained CLI installer and local/remote cluster lifecycle commands so developers can install
axin one command, bootstrap a local Kubernetes + Agent Substratev1.0.0+ AX sandbox stack without cloning upstream repositories, and deploy or upgrade AX on remote Kubernetes clusters (e.g., GKE):install.sh): Auto-detectsdarwin/linuxandamd64/arm64, verifies SHA-256 checksums, and installsaxinto~/.ax/binwithout requiringsudo(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 Kubernetesv1.36.1Kind cluster, Agent Substratev1.0.0(pure-Go Ed25519/ECDSA-P256 CA & ES256 JWK pool generation, mTLS PostgreSQL role setup,rustfs,k8s-credential-provider, and a gVisorWorkerPool), and AX — auto-downloading pinnedkind v0.32.0andkubectl v1.36.0into~/.ax/bin/on demand. Includes fail-fast container host/VM preflight validation (rootful mode, Linux kernel>= 6.8for OverlayFSlowerdir+, and RAM thresholds) across Linux and macOS.ax install/ax uninstall: install and deploy ax on the kind clusterax ctx [name]** : Lists kubeconfig contexts with live AX tunnel health, switches the active contextFor 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):Tested
docs/local_installer.md(One-line release install ) on both linux and mac.Next PRs
axCLI with the above install.sh, and then run "ax studio" to start the local web appDependency 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:Upstream currently distributes Kustomize overlays +
ate-setup(requiring a Substrate git checkout,ko, andopenssl).ax local: Embed deterministic, digest-pinned Substratev1.0.0manifests (synced viahack/sync-substrate-manifests.shand verified againstgo.modbyTestEmbeddedManifestsMatchGoModVersion) and generate local CA/JWT pools + Postgres mTLS roles in pure Go.- For
ax install: Reconcile Substrate caller allowlists in place onate-systemDeployments andk8s-credential-provider-namespace-policy(kubectl patch --type=merge).- Delete
internal/install/substrate/manifests/*.yaml(~5,490 lines) andhack/sync-substrate-manifests.sh, replacinginternal/install/substrate/bootstrap.gowith a thin Helm chart install.- Simplify/remove
internal/install/axdeploy/authz.goonce caller allowlists are exposed declaratively.ghcr.io/google/ax/*& prebuilt agent release images are not published by CI yetMeanwhile, 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.--server-imageand--default-task-imageflags (since prebuilt agent images may live in a separate registry/org on an independent release cadence) and resolve tags to@sha256digests viacrane.Digest.- Default temporarily to public multi-arch (
linux/amd64+linux/arm64) staging images built withhack/publish-multiarch-images.sh(marked with explicitTODO(release)comments).ax-serverand prebuilt agent images:- Switch
axdeploy.DefaultServerImageandaxdeploy.DefaultTaskImageininternal/install/axdeploy/deploy.gofrom the staging repo to the official release registry paths and tags.deploy/*.yaml) rather than a chartdeploy/embed.goembedsdeploy/postgres.yamlanddeploy/ax-server.yamlas the single source of truth and rewrites namespaces/image placeholders in Go (verified by multi-doc YAML tests indeploy/embed_test.go).deploy/embed.gostring rendering if AX adopts a Helm chart.go.modchange: Promotesgithub.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.Part of #543