<p>I have a secretsProviderClass resource defined for my Azure Kubernetes Service deployment, which allows me to create secrets from Azure Key Vault. I'd like to use Kustomize with it in order to unify my deployments across multiple environments. Here is my manifest:</p>
<pre><code>apiVersion: secrets-store.csi.x-k8s.io/v1alpha1
kind: SecretProviderClass
metadata:
  name: azure-kvname
spec:
  provider: azure
  secretObjects:
  - data:
    - key: dbuser
      objectName: db-user
    - key: dbpassword
      objectName: db-pass
    - key: admin
      objectName: admin-user
    - key: adminpass
      objectName: admin-password
    secretName: secret
    type: Opaque
  parameters:
    usePodIdentity: &quot;true&quot;
    keyvaultName: &quot;dev-keyvault&quot;
    cloudName: &quot;&quot;
    objects:  |
      array:
        - |
          objectName: db-user
          objectType: secret
          objectVersion: &quot;&quot;
        - |
          objectName: db-pass
          objectType: secret
          objectVersion: &quot;&quot;
        - |
          objectName: admin-user
          objectType: secret
          objectVersion: &quot;&quot;
        - |
          objectName: admin-password
          objectType: secret
          objectVersion: &quot;&quot;
    tenantId: &quot;XXXXXXXXXXXX&quot;
</code></pre>
<p>This is the manifest that I use as a base. I'd like to use overlay on this and apply values depending on the environment that I am deploying to. To be specific, I'd like to modify the <code>objectName</code> property. I tried applying the Json6902 patch:</p>
<pre><code>- op: replace
  path: /spec/parameters/objects/array/0/objectName
  value: &quot;dev-db-user&quot;

- op: replace
  path: /spec/parameters/objects/array/1/objectName
  value: &quot;dev-db-password&quot;

- op: replace
  path: /spec/parameters/objects/array/2/objectName
  value: &quot;dev-admin-user&quot;

- op: replace
  path: /spec/parameters/objects/array/3/objectName
  value: &quot;dev-admin-password&quot;
</code></pre>
<p>Unfortunately, it's not working and it is not replacing the values. Is it possible with Kustomize?</p>

<p>Unfortunately - the value that you're trying to access is not another nested YAML array - the pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value</p>
<p>With kustomize you'd probably need to replace whole <code>/spec/parameters/objects</code> value</p>
<p>if you haven't started using kustomize for good yet, you may consider rather templating engine like <a href="https://helm.sh/" rel="nofollow noreferrer">Helm</a>, which should allow you to replace value inside of this string</p>
<p>...or you can use a combination of Helm for templating and the Kustomize for resource management, patches for specific configuration, and overlays.</p>
