mittwald / kubernetes-replicator

Kubernetes controller for synchronizing secrets & config maps across namespaces
Apache License 2.0
886 stars 101 forks source link

Allow setting an arbitrary name for the copied Secret resource #271

Open HontoNoRoger opened 1 year ago

HontoNoRoger commented 1 year ago

Is your feature request related to a problem? Please describe. When dealing with Secrets which you cannot name freely (such as generated ones from some Operator), it is hard to establish a proper naming scheme in a different namespace sometimes. Especially if you have to strip the labels of the copied Secret.

Describe the solution you'd like I'd like to be able to set a specific target Secret name for push-based replications, so that the copied Secret name differs from the source Secret name. E.g. by adding another annotation to the source Secret like

replicator.v1.mittwald.de/replicate-target-name: "my-awesome-secret-from-source-namespace"

the target Secret would be created with the name specified in the source's annotation.

Based on the annotations on both the source and the target Secret, the link between them is still clear and doesn't have to match the name of the resource.

Describe alternatives you've considered Using a pull-based approach does offer choosing a free name for the copied Secret, however it involves creating an empty Secret in the first place, additionally annotating the source Secret to allow replication.