Skip to content

A Kubernetes operator to replicate resources (e.g ConfigMap, Secret, etc.) across namespaces, with optional JSON Patch custom transformations.

License

Notifications You must be signed in to change notification settings

shopstic/k8s-resource-replicator

Repository files navigation

Kubernetes Resource Replicator

CI License Docker

A very lean and fast Kubernetes operator which enables replication of resources (e.g ConfigMap, Secret, etc.) across namespaces. It also supports JSON Patch operations to allow transformation of the payload with ease.

Example of a CRD instance:

apiVersion: shopstic.com/v1 kind: ReplicatedResource metadata: name: foo-secret-replication namespace: bar spec: kind: secret fromNamespace: foo fromName: some-foo-secret toName: some-bar-secret patches: - op: replace path: "/stringData/one" value: replaced_one - op: add path: "/stringData/ten" value: added_ten - op: move from: "/stringData/three" path: "/stringData/moved_three_again_here" - op: render path: "/stringData/templated" template: |-  copy_of_one: {{stringData.one}}  copy_of_ten: {{stringData.ten}}  something_else: whatever_here  replace: false

Which will replicate a Secret named some-foo-secret from namespace foo to a Secret named some-bar-secret in namespace bar (the same namespace where this ReplicatedResource instance is created), while performing some transformations as specified as JSON Patch operations. Replication reacts almost instantaneously to any changes by leveraging "watch" capability of Kubernetes APIs.

About

A Kubernetes operator to replicate resources (e.g ConfigMap, Secret, etc.) across namespaces, with optional JSON Patch custom transformations.

Topics

Resources

License

Stars

Watchers

Forks

Packages