template-v1-from-secret.yaml 966 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {% raw %}
  2. # define your template in a config map
  3. apiVersion: v1
  4. kind: ConfigMap
  5. metadata:
  6. name: grafana-config-tpl
  7. data:
  8. config.yaml: |
  9. datasources:
  10. - name: Graphite
  11. type: graphite
  12. access: proxy
  13. url: http://localhost:8080
  14. password: "{{ .password | toString }}" # <-- convert []byte to string
  15. user: "{{ .user | toString }}" # <-- convert []byte to string
  16. ---
  17. apiVersion: external-secrets.io/v1
  18. kind: ExternalSecret
  19. metadata:
  20. name: my-template-example
  21. spec:
  22. # ...
  23. target:
  24. name: secret-to-be-created
  25. template:
  26. templateFrom:
  27. - configMap:
  28. # name of the configmap to pull in
  29. name: grafana-config-tpl
  30. # here you define the keys that should be used as template
  31. items:
  32. - key: config.yaml
  33. data:
  34. - secretKey: user
  35. remoteRef:
  36. key: /grafana/user
  37. - secretKey: password
  38. remoteRef:
  39. key: /grafana/password
  40. {% endraw %}