<p>I have a set of kubernetes config files that work in one environment.  I'm looking to deploy into another environment where I need to add an imagePullSecrets entry to all of the <code>Deployment</code> configs.</p>

<p>I can do:</p>

<p>regcred-1.yaml:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: deployment-1
spec:
  template:
    spec:
      imagePullSecrets:
      - name: regcred
</code></pre>

<p>kustomization.yaml:</p>

<pre><code>bases:
  - ../base

patchesStrategicMerge:
  - regcred-1.yaml
</code></pre>

<p>and that will patch only <code>deployment-1</code>.</p>

<p>Is there a way to apply the patch to all deployments?</p>

Job Evers
<p>Using <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/inlinePatch.md" rel="noreferrer">Inline Patch</a>:</p>
<pre class="lang-yaml prettyprint-override"><code>kind: Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
resources:
  - ../../base
patches:
  - target:
      kind: Deployment
    patch: |-
      - op: add
        path: /spec/template/spec/imagePullSecrets
        value: [{ name: image-pull-secret }]
</code></pre>
<p>Reference: <a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/patchMultipleObjects.md" rel="noreferrer">Patching multiple resources at once.</a></p>
