Argo CD on GKE
Show the whole prompt
Read https://intentius.io/chant/tutorials/argo-cd-gke/.
Using `examples/argo-cd-gke` as the model, declare the workload with `WebApp` in `src/app` and its Argo CD `Application` with `ArgoAppFor` in `src/bootstrap`.
Run `npm run build` and `npx chant lint` until both pass and ARGO001 is clean, and open a pull request with the sources and `dist/app/`.
List in its description the commands a person runs next (`npm run cluster`, `npm run install-argocd`, `npm run bootstrap`); do not run them.
Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.Optional: hand this page to your coding agent
Read https://intentius.io/chant/tutorials/argo-cd-gke/.Using `examples/argo-cd-gke` as the model, declare the workload with `WebApp` in `src/app` and its Argo CD `Application` with `ArgoAppFor` in `src/bootstrap`.Run `npm run build` and `npx chant lint` until both pass and ARGO001 is clean, and open a pull request with the sources and `dist/app/`.List in its description the commands a person runs next (`npm run cluster`, `npm run install-argocd`, `npm run bootstrap`); do not run them.Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.The smallest example of the three-layer split: Chant authors typed manifests, Argo CD reconciles them, and an Op on a steward (not needed here) drives anything procedural. A single GKE cluster runs Argo CD, and one Chant-authored workload is deployed through a K8s::Argo::Application declared in TypeScript with ArgoAppFor.
This mirrors the argo-cd-gke example.
What you’ll build
Section titled “What you’ll build”GKE cluster (Autopilot) └── Argo CD (namespace argocd) └── Application "web" ──watches──▶ git repo (dist/app/) └── reconciles ──▶ Deployment + Service (namespace demo)The k8s lexicon stays runtime-agnostic. The workload (src/app) is plain Chant k8s with no reference to Argo, and one ArgoAppFor call in src/bootstrap adds Argo.
Layout
Section titled “Layout”src/ config.ts # repo URL, paths, namespaces, the demo image app/web.ts # the workload — WebApp (Deployment + Service) bootstrap/application.ts # ArgoAppFor → the Argo Application that syncs src/appTwo build outputs:
dist/app/manifests.yaml— the workload. Commit it to the repo Argo watches.dist/argo.yaml— the ArgoApplication. Apply it once to bootstrap the GitOps loop.
1. Declare the workload
Section titled “1. Declare the workload”src/app/web.ts is ordinary Chant, a WebApp composite with no Argo in it:
import { WebApp } from "@intentius/chant-lexicon-k8s";import { config } from "../config";
const { deployment, service } = WebApp({ name: config.appName, image: config.appImage, port: config.appPort, namespace: config.appNamespace, replicas: 2,});
export { deployment, service };2. Declare the Argo Application
Section titled “2. Declare the Argo Application”src/bootstrap/application.ts adds Argo in one call:
import { ArgoAppFor } from "@intentius/chant-lexicon-k8s";import { config } from "../config";
export const web = ArgoAppFor(config.appName, { repo: config.repo, path: config.appPath, destination: { server: config.destinationServer, namespace: config.appNamespace },});That renders to ~20 lines of Application YAML with a safe automated, non-pruning, self-healing sync policy:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: web namespace: argocdspec: project: default source: repoURL: https://github.com/your-org/argo-cd-gke-demo path: dist/app targetRevision: HEAD destination: server: https://kubernetes.default.svc namespace: demo syncPolicy: automated: { prune: false, selfHeal: true } syncOptions: ["CreateNamespace=true"]3. Build and push the workload
Section titled “3. Build and push the workload”npm installnpm run build # → dist/app/manifests.yaml + dist/argo.yamlCommit dist/app/ to the repo referenced by ARGO_REPO so Argo has something to sync.
4. Create the cluster and install Argo CD
Section titled “4. Create the cluster and install Argo CD”npm run cluster # GKE Autopilot cluster (idempotent)npm run configure-kubectlnpm run install-argocd # Argo CD v2.13.3 into namespace argocd5. Bootstrap the Application
Section titled “5. Bootstrap the Application”npm run bootstrap # kubectl apply dist/argo.yamlnpm run wait # block until the Application is Healthynpm run statusWhat success looks like
Section titled “What success looks like”$ npm run statusNAME SYNC STATUS HEALTH STATUSweb Synced HealthyThe web Deployment and Service exist in the demo namespace, created by Argo rather than by kubectl apply of the workload. Change src/app, rebuild, push to git, and Argo reconciles the diff on its own.
Next steps
Section titled “Next steps”- Scope the Application to a real
AppProjectfor RBAC (ARGO002). - Fan out across regional clusters with
ArgoAppSetForRegions. - Gate procedural steps on Argo finishing with the k8s lexicon’s
waitForArgoSyncactivity. The CockroachDB multi-region tutorial does this, with Argo for the apply layer and a steward for the procedural one. - For Flux instead of Argo, Flux CD Self-Hosted has the same split on a self-hosted estate.