<p>I am working with someone else's kubernetes application. It has a long-running Deployment whose first action upon beginning to run is to create several additional, non-workload, cluster resources (<code>ValidatingWebhookConfigurations</code> and <code>MutatingWebhookConfigurations</code> in this case).</p>
<p>I would like for the generated resources to be deleted when their parent Deployment is deleted. Please assume that I don't have control over how the generated manifests are deployed, but do have control over their contents.</p>
<p>Questions:</p>
<ul>
<li>Can my goal be achieved with plain kubernetes?
<ul>
<li>In other words, can the generated resources be modified to be deleted when <code>kubectl delete deployment parent-deployment</code> is called?</li>
<li>This is preferable to handling this via Helm since some people may deploy the application using a different deployment tool.</li>
</ul>
</li>
<li>Alternatively, is there a good way to handle this with Helm if <code>parent-deployment</code> is deployed as part of a helm chart?
<ul>
<li>Can I just add helm's labels to the generated resources to make Helm aware of the new resources?</li>
<li>I, personally, will deploy the application using a Helm chart so a Helm-based solution will solve my immediate problem but won't help people who deploy the application using a different method.</li>
</ul>
</li>
</ul>

Vorticity
<p>You can use owner references and finalizers to create parent/child relationships between resources that allow you to clean up child resources when parent resources are deleted.</p>
<p>Current docs: <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/</a></p>
