What the agent does
The agent counts the deprecated fields before touching anything. In a repository like Yolean/kubernetes-kafka, sixteen kustomization.yaml files exist: fifteen use bases:, fourteen use patchesStrategicMerge: and eight use patchesJson6902:, and five of them (prometheus, variants/aws-gp2, variants/gke-regional, variants/aks-managed, variants/prometheus-operator-example) already have a resources: list beside bases:, so a search-and-replace would produce a file with two resources keys. The README tells users to run kubectl apply -k variants/scale-1/ and says kubectl is the only dependency.
Then it reproduces the warnings with both tools users have. kustomize build variants/scale-1 with kustomize 5.7.1 prints # Warning: 'bases' is deprecated. Please use 'resources' instead. Run 'kustomize edit fix' to update your Kustomization automatically. and the matching lines for patchesJson6902 and patchesStrategicMerge, three warnings per level of the overlay chain (scale-1, native, nonroot), nine lines in all before the first manifest. kubectl kustomize variants/scale-1 with kubectl 1.37.2, whose embedded kustomize is 5.8.1, prints the same. The kustomize documentation for bases says the field was deprecated in v2.1.0 and will never be removed, so this is a warning to clear, not a build about to break.
The agent tries the suggested command first and measures it. Running kustomize edit fix in every directory removes all warnings, but the rendered output of variants/scale-1 changes: the fixed version lists the JSON 6902 patches before the strategic-merge patches, and three StatefulSet objects (kafka, pzoo, zoo) gain an annotations: null line under their pod template. The agent rejects that path, because the goal is a warning-free build that renders what the cluster already runs.
So it rewrites each file by hand, in the order the old fields applied: bases entries are appended to the existing resources list, each patchesStrategicMerge path becomes a patches entry with only path, and each patchesJson6902 entry becomes patches with path and its target, placed after the strategic-merge ones. Then it renders every one of the sixteen directories before and after and compares the output. For all sixteen the output is identical, and no warning remains. Three directories fail to build on both sides for reasons that predate the change, prometheus (no StatefulSet named kafka to patch), variants/prometheus-operator-example (a remote ref of coreos/kube-prometheus that no longer exists) and variants/scale-6-9 (a JSON patch removing a readinessProbe that is not there), and the pull request lists them as pre-existing.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Our kustomize builds print \"# Warning: 'bases' is deprecated. Please use 'resources' instead\" and the same for patchesStrategicMerge and patchesJson6902. Find every kustomization.yaml, count the deprecated fields, and record the rendered output of every directory before any change. Try kustomize edit fix in a scratch copy and compare its output with the original. Then convert each file by hand: merge bases into resources, turn patchesStrategicMerge and patchesJson6902 into patches in the order they applied, and verify that kustomize build and kubectl kustomize print no warnings and byte-identical output for every directory. Open a pull request with the comparison, and list any directory that fails to build before your change as pre-existing.",
"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 that touches only kustomization.yaml files, one per directory that used a deprecated field. The description holds a table of every directory with its warning count before, zero after, and whether the rendered output is identical, plus the three directories that fail to build on both sides with the error each one prints.
A reviewer reads the diff of one overlay and sees bases folded into resources and the two patch lists merged into patches with their order kept. They can rerun the comparison themselves: render the main branch and the pull request branch for the same directory and diff the two files.
The description also records what kustomize edit fix would have produced, the patch reordering and the annotations: null lines, so the next person who reaches for that command knows why the repository did not use it.
Run it on every pull request that adds a kustomization
Old spellings come back whenever someone copies an existing overlay into a new one. An automation with a github trigger on pull_request.opened and pull_request.synchronize runs this prompt on each change, with the event appended after the prompt, and leaves a comment or a follow-up commit on its own branch when a new file uses bases, patchesStrategicMerge or patchesJson6902.
For a one-time sweep of many repositories, your server sends this request once per repository, each with its own UUID as request_id so a retry returns the run already started, and reads the results from the key's run.completed webhooks.
The use case this job follows, with its automation and trigger: Fix a bug from an alert.
Why run it on Rush?
The cheap fix and the safe fix differ here, and only rendering tells them apart. The agent has a sandbox with kustomize and kubectl, renders sixteen directories twice and diffs the results, and the run keeps every build's output. The pull request can therefore claim byte-identical manifests with the evidence attached, which a hand edit on a laptop rarely documents.
The repository has three overlays that do not build at all, for reasons unrelated to deprecations. Running every directory on both sides surfaces them and keeps them out of this change, so the reviewer sees one mechanical conversion with a known blast radius and a short list of separate problems.
Frequently asked questions
Why not just run kustomize edit fix?
Because its output is not always identical to what the repository rendered before. In the kafka repository it reordered patches and added annotations: null to three StatefulSets. The agent tries it in a scratch copy, compares, and uses it only when the rendered manifests do not change.
Is bases going to stop working?
The kustomize documentation says bases was deprecated in v2.1.0 and will never be removed. The warning is printed on every build by kustomize 5.x and by the kustomize embedded in kubectl, which is reason enough to clear it, but there is no deadline.
Does the order of patches matter?
Yes. With the old fields, strategic-merge patches applied before JSON 6902 patches. In a single patches list they apply in the order written, so the agent writes the strategic-merge entries first and checks the rendered output rather than assuming.
What if a directory already fails to build?
It is left alone and listed in the pull request with the error it prints, which is the same before and after. Fixing a dangling remote ref or a patch that targets a missing field is a different change with its own review.
More Kustomize jobs
More jobs like this: Fix a bug from an alert
- Fix "TypeError: mfcc() takes 0 positional arguments but 2 were given" in librosa (librosa)
- Fix "SetuptoolsDeprecationWarning: License classifiers are deprecated" and "project.license as a TOML table is deprecated" (setuptools)
- Fix "AttributeError: module 'locale' has no attribute 'format'" on Python 3.12 (locale)