full-external-secret.yaml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. {% raw %}
  2. apiVersion: external-secrets.io/v1
  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. # RefreshPolicy determines how the ExternalSecret should be refreshed.
  18. # - CreatedOnce: Creates the Secret only if it does not exist and does not update it afterward
  19. # - Periodic: (default) Synchronizes the Secret at intervals specified by refreshInterval
  20. # - OnChange: Only synchronizes when the ExternalSecret's metadata or specification changes
  21. refreshPolicy: Periodic
  22. # RefreshInterval is the amount of time before the values reading again from the SecretStore provider
  23. # Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h" (from time.ParseDuration)
  24. # May be set to zero to fetch and create it once
  25. refreshInterval: "1h"
  26. # the target describes the secret that shall be created
  27. # there can only be one target per ExternalSecret
  28. target:
  29. # The secret name of the resource
  30. # Defaults to .metadata.name of the ExternalSecret
  31. # It is immutable
  32. name: application-config
  33. # Specifies the ExternalSecret ownership details in the created Secret. Options:
  34. # - Owner: (default) Creates the Secret and sets .metadata.ownerReferences. If the ExternalSecret is deleted, the Secret will also be deleted.
  35. # - Merge: Does not create the Secret but merges data fields into the existing Secret (expects the Secret to already exist).
  36. # - Orphan: Creates the Secret but does not set .metadata.ownerReferences. If the Secret already exists, it will be updated.
  37. # - None: Does not create or update the Secret (reserved for future use with injector).
  38. creationPolicy: Merge
  39. # Specifies what happens to the Secret when data fields are deleted from the provider (e.g., Vault, AWS Parameter Store). Options:
  40. # - Retain: (default) Retains the Secret if all Secret data fields have been deleted from the provider.
  41. # - Delete: Removes the Secret if all Secret data fields from the provider are deleted.
  42. # - Merge: Removes keys from the Secret but not the Secret itself.
  43. deletionPolicy: Retain
  44. # Specify a blueprint for the resulting Kind=Secret
  45. template:
  46. type: kubernetes.io/dockerconfigjson # or TLS...
  47. metadata:
  48. annotations: {}
  49. labels: {}
  50. # The finalizers will be added to the Secret.
  51. # It is expected that finalizers will be deleted with custom cleanup functionality.
  52. # This is required when another chart depends on the Secret, and it is needed to prevent the Secret from being deleted too early.
  53. finalizers: []
  54. # Use inline templates to construct your desired config file that contains your secret
  55. data:
  56. config.yml: |
  57. database:
  58. connection: postgres://{{ .username }}:{{ .password }}@{{ .database_host }}:5432/payments
  59. # Uses an existing template from configmap
  60. # Secret is fetched, merged and templated within the referenced configMap data
  61. # It does not update the configmap, it creates a secret with: data["alertmanager.yml"] = ...result...
  62. templateFrom:
  63. - configMap:
  64. name: application-config-tmpl
  65. items:
  66. - key: config.yml
  67. # Data defines the connection between the Kubernetes Secret keys and the Provider data
  68. data:
  69. - secretKey: username
  70. remoteRef:
  71. key: database-credentials
  72. version: v1
  73. property: username
  74. decodingStrategy: None # can be None, Base64, Base64URL or Auto
  75. # define the source of the secret. Can be a SecretStore or a Generator kind
  76. sourceRef:
  77. # point to a SecretStore that should be used to fetch a secret.
  78. # must be defined if no spec.secretStoreRef is defined.
  79. storeRef:
  80. name: aws-secretstore
  81. kind: ClusterSecretStore
  82. # Used to fetch all properties from the Provider key
  83. # If multiple dataFrom are specified, secrets are merged in the specified order
  84. # Can be defined using sourceRef.generatorRef or extract / find
  85. # Both use cases are exemplified below
  86. dataFrom:
  87. - sourceRef:
  88. generatorRef:
  89. apiVersion: generators.external-secrets.io/v1alpha1
  90. kind: ECRAuthorizationToken
  91. name: "my-ecr"
  92. #Or
  93. dataFrom:
  94. - extract:
  95. key: database-credentials
  96. version: v1
  97. property: data
  98. conversionStrategy: Default
  99. decodingStrategy: Auto
  100. rewrite:
  101. - regexp:
  102. source: "exp-(.*?)-ression"
  103. target: "rewriting-${1}-with-groups"
  104. - find:
  105. path: path-to-filter
  106. name:
  107. regexp: ".*foobar.*"
  108. tags:
  109. foo: bar
  110. conversionStrategy: Unicode
  111. decodingStrategy: Base64
  112. rewrite:
  113. - regexp:
  114. source: "foo"
  115. target: "bar"
  116. status:
  117. # refreshTime is the time and date the external secret was fetched and
  118. # the target secret updated
  119. refreshTime: "2019-08-12T12:33:02Z"
  120. # Standard condition schema
  121. conditions:
  122. # ExternalSecret ready condition indicates the secret is ready for use.
  123. # This is defined as:
  124. # - The target secret exists
  125. # - The target secret has been refreshed within the last refreshInterval
  126. # - The target secret content is up-to-date based on any target templates
  127. - type: Ready
  128. status: "True" # False if last refresh was not successful
  129. reason: "SecretSynced"
  130. message: "Secret was synced"
  131. lastTransitionTime: "2019-08-12T12:33:02Z"
  132. {% endraw %}