full-cluster-push-secret.yaml 4.2 KB

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