0

How can I refer secret value from custom resource ? I am trying some thing like below but its not working

configuration:
  baseUrl: "some url"
  username: "jack"
  password:
    valueFrom:
      secretKeyRef:
        key: identityServiceInstanceURL
        name: oauthpassword

password is considered as map instead string replacement , it gives below error

error: error validating "intg/helm/templates/CRDS.yaml": error validating data: ValidationError(Test.spec.configuration.password): invalid type for Test.spec.configuration.password: got "map", expected "string"; if you choose to ignore these errors, turn validation off with --validate=false
chresse
  • 5,486
  • 3
  • 30
  • 47
santosh jk
  • 111
  • 1
  • 11
  • It seems your CRD does not support referencing a secret key in the `password` field. – chresse May 18 '22 at 11:14
  • 1
    More specifically, your operator code and the CustomResourceDefinition would need to support this. The `valueFrom: {secretKeyRef:}` syntax you show is normally very specific to the `env:` field in a Pod spec and isn't understood anywhere else. Do you have, perhaps, an excerpt of the Kubebuilder Go code for your operator that you could include in your question? – David Maze May 18 '22 at 23:13

0 Answers0