<p>I would like to create <strong>component</strong> reused in many deployments. It has monitoring sidecar same for all applications. My problem is that I would like to apply strategic merge patch from this component but it only works when I'm using name of specific deployment</p>
<pre><code>#------deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-deploy
spec:
  template:
    metadata:
      labels:
        app: sample-app
    spec:
      containers:
      - name: sample-container
#--------kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml

components:
- ../../../.k8s/components/monitor-sidecar
#------kustomization.yaml (component)
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- deployment-sidecar.yaml
#-------deployment-sidecar.yaml
apiVersion: apps/v1
kind: Deployment
# metadata:
#   name: sample-deploy &lt;-I have to uncoment this but it attach component to one deployment
spec:
  template:
    spec:
      containers:
      - name: monitor-sidecar
        image: MONITOR-SIDECAR.IMG
   
</code></pre>
<p>When I skip the name (name: sample-deploy in examle) I have an error &quot;missing metadata.name in object&quot;. How can I create generic component without attaching it to specific deployment name? I would like to init component when it is used and not define such things in definision.</p>

dnf
<p>I missed the target section - with this it works. I still have to use some name in patch but it is ignored</p>
<pre><code>- path: patch.yaml
  target:
    kind: Deployment
</code></pre>
