0

I am trying to pass values from the object:

values.yaml

objects:
- name: kv-secret-name-1
  type: secret
- name: kv-secret-name-2
  type: secret

and create the 'SecretProviderClass` resource. Expected format is:

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  name: azure-kvname-wi # needs to be unique per namespace
spec:
  provider: azure
  parameters:
    objects: |
      array:
      - |
        objectName: kv-secret-name-1    # Set to the name of your secret
        objectType: secret              # object types: secret, key, or cert
      - |
        objectName: kv-secret-name-2    # Set to the name of your secret
        objectType: secret              # object types: secret, key, or cert
      

I was trying to loop inside objects param but got error converting YAML to JSON, like this:

...
objects: |
  array:
{{- range $o := .Values.objects }}
  - |
    objectName: {{ $o.name }}
    objectType: {{ $o.type }}
{{- end }}
...

Any suggestion?

2
  • That range loop matches almost exactly what I'd write here. Have you tried running helm template --debug to see what YAML actually gets written out? Sometimes that error can come from extra {{- ... -}} whitespace-control hyphens, maybe in the line before or after what you've shown here. Commented Aug 11 at 13:51
  • You are right. The issue was in the next (commented) line. Thank you. Commented Aug 12 at 6:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.