Repository navigation
feat(tts-audio): prune objects the repo no longer declares - #285
Merged
Merged
Conversation
`kubectl apply` is create-or-update, so renaming a resource in the repo leaves
the old object running forever. That already happened: renaming
`allow-webhook-kubernetes-api` to `allow-kubernetes-api-egress` left both
NetworkPolicies in the cluster, and the stale one still matches every webhook pod
and still permits egress to the API server. For a NetworkPolicy, "still there"
means "still permitting".
- `make prune` compares the rendered manifests with the labelled objects in the
cluster and lists what is no longer declared. It is a **dry run by default**;
`CONFIRM=1` deletes.
- It only considers kinds this repo owns and only objects labelled
`app.kubernetes.io/part-of=tts-audio`, so the Secret (created by `make
secret`), Jobs (one-off history), Namespaces and anything foreign are never
touched.
- `make test` asserts it stays dry without confirmation.
Run against the live cluster, it reports exactly one object — the orphaned
networkpolicy and nothing else:
prune: 1 object(s) in the cluster are no longer declared:
- networkpolicy/allow-webhook-kubernetes-api (namespace tts-audio)
ngeorger
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
kubectl applyis a create-or-update verb: it never removes an object whose name changed in the repo. That already happened here.The drift
Renaming
allow-webhook-kubernetes-api→allow-kubernetes-api-egress(in #283) left both NetworkPolicies in the cluster:For a NetworkPolicy, "still there" means "still permitting". The stale rule silently widened egress to the API server for every webhook pod — exactly the kind of drift that never shows up as an error.
Verified against the live cluster: the repo declares 4 NetworkPolicies, the cluster has 5.
The fix
make prunecompares the rendered manifests with the labelled objects in the cluster and lists what is no longer declared.CONFIRM=1deletes.networkpolicy httproute serviceaccount role rolebinding poddisruptionbudget horizontalpodautoscaler service configmap deployment.app.kubernetes.io/part-of=tts-audio, so anything foreign is invisible to it.secret(created bymake secret),job(one-off history) ornamespace.Run against the live cluster it reports exactly one object and nothing else:
make testasserts it stays dry without confirmation.After merging
Gates
deploy/tts-audio/test.sh✅ ·yarn verify✅