full-cluster-push-secret.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. {% raw %}
  2. ---
  3. # The source secret that will be pushed to the destination secret by ClusterPushSecret.
  4. apiVersion: v1
  5. kind: Secret
  6. metadata:
  7. name: source-secret
  8. stringData:
  9. best-pokemon-src: "Pikachu"
  10. ---
  11. apiVersion: external-secrets.io/v1alpha1
  12. kind: ClusterPushSecret
  13. metadata:
  14. name: "hello-world"
  15. spec:
  16. # The name to be used on the PushSecrets
  17. pushSecretName: "hello-world-ps"
  18. # This is a list of basic label selector to select the namespaces to deploy PushSecrets to.
  19. # you can read more about them here https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#resources-that-support-set-based-requirements
  20. # The list is OR'd together, so if any of the namespaceSelectors match the namespace,
  21. # the ExternalSecret will be deployed to that namespace.
  22. namespaceSelectors:
  23. - matchLabels:
  24. cool: label
  25. # How often the ClusterPushSecret should reconcile itself
  26. # This will decide how often to check and make sure that the PushSecrets exist in the matching namespaces
  27. refreshTime: "1m"
  28. # This is the spec of the PushSecrets to be created
  29. # The content of this was taken from our PushSecret example
  30. pushSecretSpec:
  31. updatePolicy: Replace # Policy to overwrite existing secrets in the provider on sync
  32. deletionPolicy: Delete # the provider' secret will be deleted if the PushSecret is deleted
  33. refreshInterval: 1h # Refresh interval for which push secret will reconcile
  34. secretStoreRefs: # A list of secret stores to push secrets to
  35. - name: aws-parameterstore
  36. kind: SecretStore
  37. selector:
  38. secret:
  39. name: source-secret # Source Kubernetes secret to be pushed
  40. # Alternatively, you can point to a generator that produces values to be pushed
  41. generatorRef:
  42. apiVersion: external-secrets.io/v1alpha1
  43. kind: ECRAuthorizationToken
  44. name: prod-registry-credentials
  45. template:
  46. metadata:
  47. annotations: { }
  48. labels: { }
  49. data:
  50. # If the key source secret key has dashes, then it cannot be accessed directly,
  51. # and the "index" function should be used.
  52. best-pokemon: "{{ index . \"best-pokemon-src\" | toString | upper }} is the really best!"
  53. # Also, it's possible to use an existing template from configmap where Secret is fetched,
  54. # merged and templated within the referenced configMap data.
  55. # It does not update the configmap, it creates a secret with: data["config.yml"] = ...result...
  56. templateFrom:
  57. - configMap:
  58. name: application-config-tmpl
  59. items:
  60. - key: config.yml
  61. data:
  62. - conversionStrategy: None # Also supports the ReverseUnicode strategy
  63. match:
  64. # The secretKey is used within ClusterPushSecret (it should match key under spec.pushSecretSpec.template.data)
  65. secretKey: best-pokemon
  66. remoteRef:
  67. remoteKey: destination-secret # The destination secret object name (where the secret is going to be pushed)
  68. property: best-pokemon-dst # The key within the destination secret object.
  69. status:
  70. # This will list any namespaces where the creation of the ExternalSecret failed
  71. # This will not list any issues with the ExternalSecrets, you will have to check the
  72. # ExternalSecrets to see any issues with them.
  73. failedNamespaces:
  74. - namespace: "matching-ns-1"
  75. # This is one of the possible messages, and likely the most common
  76. reason: "external secret already exists in namespace"
  77. # You can find all matching and successfully deployed namespaces here
  78. provisionedNamespaces:
  79. - "matching-ns-3"
  80. - "matching-ns-2"
  81. # The condition can be Ready, PartiallyReady, or NotReady
  82. # PartiallyReady would indicate an error in 1 or more namespaces
  83. # NotReady would indicate errors in all namespaces meaning all ExternalSecrets resulted in errors
  84. conditions:
  85. - type: PartiallyReady
  86. status: "True"
  87. lastTransitionTime: "2022-01-12T12:33:02Z"
  88. {% endraw %}