Skip to content

[POC-DNS] feat(cli): add ax local, ax install/uninstall, and local installer guide - #558

Closed
YoyinZyc wants to merge 1 commit into
google:mainfrom
YoyinZyc:poc/ax-installer
Closed

YoyinZyc wants to merge 1 commit into
google:mainfrom
YoyinZyc:poc/ax-installer

Conversation

@YoyinZyc

@YoyinZyc YoyinZyc commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a self-contained CLI installer and local development stack so developers can stand up AX locally in one command and promote the exact same Task manifests to a remote Kubernetes cluster (e.g., GKE) without manual YAML surgery or external setup scripts:

  • ax local <up|status|stop|delete>: Bootstraps a local Kubernetes 1.36+ Kind cluster, Agent Substrate v1.0.0-rc.1, and AX in one command (auto-downloading kind / kubectl into ~/.ax/bin/ on demand without sudo).
  • ax install / ax uninstall: Resolves @sha256 image digests (via go-containerregistry/pkg/crane), idempotently configures AX caller permissions in Agent Substrate (ate-api-server, atenet-router, and k8s-credential-provider gated by ax.io/credential="true"), and deploys/removes ax-postgres + ax-server.
  • ax ctx [name]: Lists kubeconfig contexts with live AX tunnel status and switches the active context (kubectl config use-context), while isolating cached router mTLS certs by cluster server + CA fingerprint.

For the full end-to-end user journey (local bootstrap -> task/snapshot verification -> zero-diff promotion to GKE -> cleanup), see docs/local_installer.md.

The installer follows three-layer installation:

image

related issue: #526
Note: the pr is just for poc.


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 pre-rendered Substrate v1.0.0-rc.1 manifests (synced deterministically via hack/sync-substrate-manifests.sh and checked against go.mod in unit tests) and generate local CA/JWT keys + Postgres mTLS init in pure Go.
- For ax install: Reconcile Substrate caller allowlists by patching ate-system flags/ConfigMaps via kubectl.
Once Substrate ships a Helm chart:
- Delete internal/install/substrate/ (manifests/*.yaml, bootstrap.go, pki.go) and hack/sync-substrate-manifests.sh (~6,300 lines, mostly generated YAML), replacing them with helm upgrade --install.
- Delete internal/install/axdeploy/authz.go once caller allowlists are exposed via Helm values or declarative config.
2. Pre-built AX images (ghcr.io/google/ax/*) are not published yet
Meanwhile, Substrate strictly requires @sha256-pinned task images so gVisor snapshots stay valid across nodes.
- Added --from-source <dir> to cross-compile, build, and push AX images to a local loopback registry (127.0.0.1:5001) or a user's cloud registry.
- Added crane.Digest tag-to-@sha256 resolution so standard registry tags work automatically once images are published.
Once official AX release images are published:
- Normal users will no longer need --from-source (or a Go/Docker build environment on ax install).
- The local loopback registry setup in internal/install/cluster/kind.go (ensureLocalRegistry) can be skipped/removed for default ax local up runs.
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. If AX adopts a Helm chart, deploy/embed.go string rendering can be removed in favor of chart values.

go.mod change: Adds go-containerregistry v0.21.7 (matching Substrate) for OCI digest resolution and Docker keychain auth

Reviewer tip: Over half of the line count in this PR (internal/install/substrate/manifests/01..07-*.yaml, ~5,460 lines) is deterministically generated from Agent Substrate v1.0.0-rc.1 by hack/sync-substrate-manifests.sh and verified by TestEmbeddedManifestsMatchGoModVersion — you can safely collapse those 7 files during review.


Verification

  • Unit & contract tests: go mod tidy, go build ./..., go test ./..., go vet ./...
  • End-to-end manual verification:
    • Verified full ax local up --from-source . -> Task apply / ssh / suspend / resume -> ax local stop / up / delete lifecycle on a clean Linux environment.
    • Verified multi-cluster promotion (ax ctx + ax install --from-source . --image-repo <gar-repo>) and ax uninstall against a live GKE 1.37 cluster running Agent Substrate v1.0.0-rc.1.

- Add `ax local <up|status|stop|delete>` to bootstrap a self-contained
  Kubernetes 1.36+ Kind cluster, loopback registry (127.0.0.1:5001),
  Agent Substrate v1.0.0-rc.1 (pure-Go CA pools + mTLS Postgres init +
  rustfs + k8s-credential-provider + gVisor WorkerPool), and AX.
- Add `ax install` and `ax uninstall` to build/resolve @sha256-pinned AX
  images via `go-containerregistry/pkg/crane`, idempotently reconcile
  Substrate caller allowlists (ate-api-server, atenet-router, and
  k8s-credential-provider gated by ax.io/credential=true), and deploy or
  remove AX on any Kubernetes 1.36+ cluster.
- Enhance `ax ctx [name]` to list kubeconfig contexts with live AX tunnel
  health and switch the active context via `kubectl config use-context`,
  while isolating router mTLS caches by cluster server+CA fingerprint.
- Add English end-to-end walkthrough in `docs/local_installer.md` and sync
  `AGENTS.md`, `skills/substrate/SKILL.md`, and docs.
@YoyinZyc

Copy link
Copy Markdown
Collaborator Author

Closed in favor of #603

@YoyinZyc YoyinZyc closed this Nov 15, 2026
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