mittwald / kubernetes-replicator

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

Allow replication of only certain keys #248

Open slimm609 opened 1 year ago

slimm609 commented 1 year ago

Is your feature request related to a problem? Please describe. When replicating secrets, you may not want to allow the replication of all objects in the secret and instead only a subset of fields

Describe the solution you'd like

apiVersion: v1
kind: Secret
metadata:
  annotations:
    replicator.v1.mittwald.de/replication-allowed: "true"
    replicator.v1.mittwald.de/replication-allowed-namespaces: "*"
    replicator.v1.mittwald.de/replication-allowed-keys: "ca.crt,tls.crt"
data:
  ca.crt: <value1>
  tls.key: <value2>
  tls.crt: <value>
apiVersion: v1
kind: Secret
metadata:
  name: tls-secret-replica
  annotations:
    replicator.v1.mittwald.de/replicate-from: default/some-tls-secret
type: kubernetes.io/tls
data:
  tls.key: ""
  tls.crt: ""
  ca.crt: ""

the replicated secret would leave tls.key as an empty field and populate only the 2 other fields populated.