All jobs

Add a Staging Overlay with Kustomize from a Linear Issue

An agent adds a staging overlay to the kustomize-guestbook base, an Argo CD Application for it, and a script that renders and validates four Kustomize apps.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent read kustomize-guestbook/kustomization.yaml first: a base with namePrefix: kustomize- whose Deployment already sets replicas: 1, in a repository with no tests or CI. Its first overlay, at kustomize-guestbook/overlays/staging, failed kustomize build with cycle detected, because an overlay inside its own base is a loop. It moved the overlay to a sibling directory, kustomize-guestbook-staging/.

There, kustomization.yaml takes ../kustomize-guestbook as its resource, sets namespace: staging, nameSuffix: -staging and an explicit replica count of 1, so the objects come out as kustomize-guestbook-ui-staging. application.yaml points spec.source.path at the overlay with destination namespace staging. test.sh asserts those values and that the Service selector still matches app: guestbook-ui.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "A Linear issue labeled agent says: \"Add a Staging Overlay with Kustomize. Add a staging overlay for kustomize-guestbook with one replica, a staging namespace and a name suffix, and an Argo CD Application that points at it.\" Do the work in this repository, add tests for it, run kustomize build and kubeconform for each app, and open a pull request that links back to the issue.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

Tried on argoproj/argocd-example-apps at 8088f4c: 3 files changed, 56 insertions(+), all new: kustomization.yaml (+12), application.yaml (+17) and test.sh (+27). The issue text was written for the trial and sits in the request; the run was given no Linear issue id, so it read no issue and there is no link back. It installed kustomize v5.4.3 and kubeconform v0.8.0, which were missing. ./kustomize-guestbook-staging/test.sh runs four apps through kubeconform and ends staging overlay assertions passed, exit 0. With count: 3 the same script fails FAIL: expected replicas: 1. No pull request was opened.

For the reviewer: the layout, and the Application's CreateNamespace=true with no automated sync. kubeconform skipped the Application (Skipped: 1) for lack of a CRD schema. Helm was not installed, so plugins/kustomized-helm went unchecked, and the raw Helm templates in blue-green already failed kubeconform with 5 errors before the change.

Run it on every Linear issue labelled for a new environment

An automation with a linear trigger on linear.issue.labeled and a label such as environments runs the recipe's saved prompt with the labelled issue as context. An issue that names the app, the namespace and the suffix, as this trial's text did, gives the agent what it needs.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

The obvious home for the overlay, overlays/staging inside the app, does not build in this repository. The run hit kustomize's cycle error, moved the overlay out, and then proved its test bites: setting three replicas made test.sh fail before it was reverted.

Frequently asked questions

Why is the overlay not under kustomize-guestbook/overlays?

Kustomize refuses an overlay nested inside the base it references and reports cycle detected. The run hit exactly that, so the overlay is kustomize-guestbook-staging/, a sibling of the base.

Is the Argo CD Application deployed by the overlay?

No. application.yaml sits in the overlay directory but is not listed in kustomization.yaml, so kustomize build leaves it out. You apply it to the argocd namespace once; it was not schema-checked, since kubeconform has no bundled schema for the CRD.

More Kustomize jobs

More jobs like this: Turn a Linear label into a PR

Keep reading