Find dangling Kubernetes resource references
ProprietaryFind resources that refer by name to a ConfigMap, Secret, ServiceAccount, Service, PersistentVolumeClaim, Role, ClusterRole, PriorityClass or scale target that this repository declares nowhere. There is no safe automated fix for a dangling reference — the name is either a typo, a leftover, or satisfied out of band — so this only reports. Namespace is ignored when resolving, a kustomization's namePrefix and nameSuffix are replayed so that the name a cluster sees resolves as well as the one on disk, and references whose value is templated, whose target kind appears nowhere in the repository, or whose target kind has a name some template computes are all left alone.
org. openrewrite. kubernetes. search. FindDanglingResourceReferencesOptional
Files to index resources from. This is a glob expression, and every YAML file is indexed when it is omitted. Narrowing this manufactures findings: a reference is dangling only when nothing anywhere declares its target.
Only report references found in matching files. This is a glob expression. The whole repository is indexed either way.
Only report a reference when the repository declares at least one resource of the kind being referred to. A repository with no PersistentVolumeClaim in it has its claims satisfied by an operator or an administrator, and reporting them is noise. Default true.
mod run . --recipe= org. openrewrite. kubernetes. search. FindDanglingResourceReferencesInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.