full-external-secret.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {% raw %}
  2. apiVersion: external-secrets.io/v1beta1
  3. kind: ExternalSecret
  4. metadata:
  5. name: "hello-world"
  6. # labels and annotations are copied over to the
  7. # secret that will be created
  8. labels:
  9. acme.org/owned-by: "q-team"
  10. annotations:
  11. acme.org/sha: 1234
  12. spec:
  13. # Optional, SecretStoreRef defines the default SecretStore to use when fetching the secret data.
  14. secretStoreRef:
  15. name: aws-store
  16. kind: SecretStore # or ClusterSecretStore
  17. # RefreshInterval is the amount of time before the values reading again from the SecretStore provider
  18. # Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h" (from time.ParseDuration)
  19. # May be set to zero to fetch and create it once
  20. refreshInterval: "1h"
  21. # the target describes the secret that shall be created
  22. # there can only be one target per ExternalSecret
  23. target:
  24. # The secret name of the resource
  25. # Defaults to .metadata.name of the ExternalSecret
  26. # It is immutable
  27. name: application-config
  28. # Enum with values: 'Owner', 'Merge', or 'None'
  29. # Default value of 'Owner'
  30. # Owner creates the secret and sets .metadata.ownerReferences of the resource
  31. # Merge does not create the secret, but merges in the data fields to the secret
  32. # None does not create a secret (future use with injector)
  33. creationPolicy: 'Merge'
  34. # DeletionPolicy defines how/when to delete the Secret in Kubernetes
  35. # if the provider secret gets deleted.
  36. # Valid values are Delete, Merge, Retain
  37. deletionPolicy: "Retain"
  38. # Specify a blueprint for the resulting Kind=Secret
  39. template:
  40. type: kubernetes.io/dockerconfigjson # or TLS...
  41. metadata:
  42. annotations: {}
  43. labels: {}
  44. # Use inline templates to construct your desired config file that contains your secret
  45. data:
  46. config.yml: |
  47. database:
  48. connection: postgres://{{ .username }}:{{ .password }}@{{ .database_host }}:5432/payments
  49. # Uses an existing template from configmap
  50. # Secret is fetched, merged and templated within the referenced configMap data
  51. # It does not update the configmap, it creates a secret with: data["alertmanager.yml"] = ...result...
  52. templateFrom:
  53. - configMap:
  54. name: application-config-tmpl
  55. items:
  56. - key: config.yml
  57. # Data defines the connection between the Kubernetes Secret keys and the Provider data
  58. data:
  59. - secretKey: username
  60. remoteRef:
  61. key: database-credentials
  62. version: v1
  63. property: username
  64. decodingStrategy: None # can be None, Base64, Base64URL or Auto
  65. # define the source of the secret. Can be a SecretStore or a Generator kind
  66. sourceRef:
  67. # point to a SecretStore that should be used to fetch a secret.
  68. # must be defined if no spec.secretStoreRef is defined.
  69. storeRef:
  70. name: aws-secretstore
  71. kind: ClusterSecretStore
  72. # Used to fetch all properties from the Provider key
  73. # If multiple dataFrom are specified, secrets are merged in the specified order
  74. dataFrom:
  75. - extract:
  76. key: database-credentials
  77. version: v1
  78. property: data
  79. conversionStrategy: Default
  80. decodingStrategy: Auto
  81. rewrite:
  82. - regexp:
  83. source: "exp-(.*?)-ression"
  84. target: "rewriting-${1}-with-groups"
  85. - find:
  86. path: path-to-filter
  87. source: "exp-(.*?)-ression"
  88. target: "rewriting-${1}-with-groups"
  89. name:
  90. regexp: ".*foobar.*"
  91. tags:
  92. foo: bar
  93. conversionStrategy: Unicode
  94. decodingStrategy: Base64
  95. rewrite:
  96. - regexp:
  97. source: "foo"
  98. target: "bar"
  99. status:
  100. # refreshTime is the time and date the external secret was fetched and
  101. # the target secret updated
  102. refreshTime: "2019-08-12T12:33:02Z"
  103. # Standard condition schema
  104. conditions:
  105. # ExternalSecret ready condition indicates the secret is ready for use.
  106. # This is defined as:
  107. # - The target secret exists
  108. # - The target secret has been refreshed within the last refreshInterval
  109. # - The target secret content is up-to-date based on any target templates
  110. - type: Ready
  111. status: "True" # False if last refresh was not successful
  112. reason: "SecretSynced"
  113. message: "Secret was synced"
  114. lastTransitionTime: "2019-08-12T12:33:02Z"
  115. {% endraw %}