What the agent does
The agent reads the repository the way Argo CD does, one source path per Application. In a layout like argoproj/argocd-example-apps, apps/ is an app-of-apps Helm chart whose templates/applications.yaml ranges over values.yaml and makes one Application per entry, each with syncPolicy.automated set to prune: true and selfHeal: true and CreateNamespace=true, and each pointing at a directory of this same repository: guestbook/ is plain YAML, helm-guestbook/ a chart, kustomize-guestbook/ a kustomization with namePrefix: kustomize-, sync-waves/ a single manifests.yaml, blue-green/ a chart with an Argo Rollouts Rollout, sock-shop/ a kustomize base of 14 Deployments, and pre-post-sync/ two Jobs. The agent lists every Deployment, ReplicaSet, StatefulSet and Rollout across them with its replica count and its selector labels, because a budget is only as correct as the selector that ties it to its pods.
The replica counts decide what a budget may say. guestbook/guestbook-ui-deployment.yaml runs replicas: 1; helm-guestbook/values.yaml sets replicaCount: 1 and values-production.yaml only switches the Service to LoadBalancer; blue-green/values.yaml is also replicaCount: 1; the two ReplicaSets in sync-waves/manifests.yaml and all 14 Deployments under sock-shop/base/ run one replica. A minAvailable: 1 budget on a one-replica workload never lets a node drain, so the agent writes maxUnavailable: 1 for every single-replica workload, which allows the eviction while still recording the intent, and uses minAvailable only where a chart value or an overlay sets replicas above one. The budget's selector.matchLabels is copied from each workload's spec.selector, and for the kustomize app the agent checks that namePrefix renames the Deployment but not its labels, so the selector still matches after the build.
Each budget goes where its tool expects it. For guestbook/, a guestbook-ui-pdb.yaml beside the Deployment and Service, since Argo CD reads every file in the directory. For kustomize-guestbook/ the same file plus a line in kustomization.yaml, and for sock-shop/base/ one *-pdb.yaml per Deployment added to its kustomization.yaml; the databases, carts-db, orders-db, user-db and session-db, get a budget like the rest, and the pull request calls out that their single replica means the budget documents rather than protects them. For helm-guestbook/ and blue-green/ a templates/pdb.yaml behind podDisruptionBudget.enabled in values.yaml, defaulting to true, with minAvailable and maxUnavailable both settable and a template guard that refuses both at once, since the API rejects that. Jobs and the hook ReplicaSets in sync-waves/ get no budget, and the description says why. Every budget uses policy/v1, so the pull request also states the minimum Kubernetes version the repository now assumes.
Then it proves the result renders. It installs helm, kustomize and the Argo CD CLI, runs helm template on each chart with its default and production values, kustomize build on each kustomization, and kubectl apply --dry-run=client over every rendered document to catch a selector that matches nothing or a budget that names both fields. It also notes how Argo CD will show the new objects: Argo CD ships a health check for PodDisruptionBudget that reports Degraded on a False condition unless its reason is InsufficientPods, so neither form of budget degrades an Application's health on its own; the choice between them is about drains, not about the UI. Because every Application syncs automatically with pruning and self-heal, merging the pull request creates the budgets on the cluster; the description says so, so a reviewer merges knowing it.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add PodDisruptionBudgets to the Argo CD applications in this repository. Read the app-of-apps chart first to learn each Application's source path, then every Deployment, ReplicaSet, StatefulSet and Rollout under those paths, with its replicas and selector labels. Write one policy/v1 PodDisruptionBudget per long-running workload: maxUnavailable 1 where the workload runs a single replica, minAvailable where replicas are above one, with selector labels copied from the workload's spec.selector. Put each budget where its tool expects it: a file beside plain manifests, a resource line in each kustomization.yaml, and a template behind a podDisruptionBudget.enabled value in each Helm chart that refuses minAvailable and maxUnavailable together. Skip Jobs and sync hooks and say why. Install helm and kustomize, render every app with its default and production values, and run kubectl apply --dry-run=client over the output. Open a pull request that lists each budget, the workload and replica count it covers, and notes that automated sync will create them on merge.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- 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.
- 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.
- 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
A pull request with one new budget file per plain-YAML and kustomize workload, the kustomization.yaml lines that include them, and a templates/pdb.yaml plus a values.yaml block in each Helm chart. Its description is a table: Application, workload, replicas, the budget's field and value, and where the file lives, followed by the list of what got no budget and why, and the kubectl apply --dry-run=client summary; the rendered output of every app is in the run's record.
A reviewer reads the table against what they know of the cluster. A workload the table shows at one replica with maxUnavailable: 1 is a budget that documents intent, and the reviewer decides whether to raise replicas first. For the charts, the reviewer checks that podDisruptionBudget.enabled defaults the way they want for existing installs, since automated sync with pruning means the merge is the deploy.
Run it on every terminal hand-off
A platform engineer who has been asked for budgets before the next node pool upgrade starts this from the terminal with this body and the GitOps repository in resources, then moves on. The run reads the real Applications and the real replica counts, so each budget's form follows the workload rather than a template.
Send a request_id, a UUID, with the body so a retried start returns the run it already began. When the turn ends, GET /o/{org}/sessions/{id} names the pull request, and a follow-up to the same session can ask it to raise a workload's replicas to two and switch that budget to minAvailable: 1 in the same branch.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A budget is a small object with a large blast radius: a minAvailable that equals the replica count stalls every drain in the cluster, and a selector that matches nothing protects nothing while looking fine in the UI. Getting them right across a dozen Applications means reading each workload's replicas and labels and rendering each tool's output, which the agent does in its own sandbox with helm, kustomize and kubectl installed there, and the pull request carries the rendered proof.
The same run fits a GitOps repository of any shape, since it starts from the Applications and follows their source paths: a monorepo with fifty kustomize overlays, a chart-per-service layout, or a mix with Rollouts. Each gets budgets in the form its tool expects, every run keeps the full record of what it rendered, and the reviewer's job is reduced to reading one table.
Frequently asked questions
Why maxUnavailable 1 instead of minAvailable 1 on a single replica?
minAvailable: 1 on one replica means no voluntary eviction is ever allowed, so node drains and upgrades hang on that pod. maxUnavailable: 1 lets the drain proceed and keeps the budget's intent on record, and the pull request's table shows which workloads need more replicas before minAvailable makes sense.
Will merging the pull request change the cluster?
In a repository whose Applications sync automatically with pruning and self-heal, yes: the budgets are created on the next sync after merge. The agent says so in the description. If you want to stage it, merge with the Helm value set to false and flip it per environment.
Does it handle Argo Rollouts and StatefulSets?
Yes. A Rollout gets a budget with its selector like a Deployment, and a StatefulSet gets one too; both keep the single-replica rule. Jobs, CronJobs and sync-hook ReplicaSets are skipped, since a budget on a workload that is meant to finish only blocks cleanup.
What if a kustomize overlay changes replicas per environment?
The agent renders each overlay it finds and writes the budget where the replica count is set, so a production overlay that raises replicas to three gets minAvailable in that overlay while the base keeps maxUnavailable: 1. The table in the pull request lists the value per environment.