Skip to content

Latest commit

 

History

History
48 lines (43 loc) · 1.88 KB

README.md

File metadata and controls

48 lines (43 loc) · 1.88 KB

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.