full-external-secret.yaml 4.9 KB

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