full-external-secret.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. # point to a generator resource that provides the secret value
  73. generatorRef:
  74. apiVersion: generators.external-secrets.io/v1alpha1
  75. kind: Password
  76. name: db-password
  77. # Used to fetch all properties from the Provider key
  78. # If multiple dataFrom are specified, secrets are merged in the specified order
  79. dataFrom:
  80. - extract:
  81. key: database-credentials
  82. version: v1
  83. property: data
  84. conversionStrategy: Default
  85. decodingStrategy: Auto
  86. rewrite:
  87. - regexp:
  88. source: "exp-(.*?)-ression"
  89. target: "rewriting-${1}-with-groups"
  90. - find:
  91. path: path-to-filter
  92. source: "exp-(.*?)-ression"
  93. target: "rewriting-${1}-with-groups"
  94. name:
  95. regexp: ".*foobar.*"
  96. tags:
  97. foo: bar
  98. conversionStrategy: Unicode
  99. decodingStrategy: Base64
  100. rewrite:
  101. - regexp:
  102. source: "foo"
  103. target: "bar"
  104. status:
  105. # refreshTime is the time and date the external secret was fetched and
  106. # the target secret updated
  107. refreshTime: "2019-08-12T12:33:02Z"
  108. # Standard condition schema
  109. conditions:
  110. # ExternalSecret ready condition indicates the secret is ready for use.
  111. # This is defined as:
  112. # - The target secret exists
  113. # - The target secret has been refreshed within the last refreshInterval
  114. # - The target secret content is up-to-date based on any target templates
  115. - type: Ready
  116. status: "True" # False if last refresh was not successful
  117. reason: "SecretSynced"
  118. message: "Secret was synced"
  119. lastTransitionTime: "2019-08-12T12:33:02Z"
  120. {% endraw %}