https://github.com/shopstic/k8s-resource-replicator
A Kubernetes operator to replicate resources (e.g ConfigMap, Secret, etc.) across namespaces, with optional JSON Patch custom transformations.
https://github.com/shopstic/k8s-resource-replicator
configmap crd jsonpatch kubernetes operator secrets
Last synced: 8 months ago
JSON representation
A Kubernetes operator to replicate resources (e.g ConfigMap, Secret, etc.) across namespaces, with optional JSON Patch custom transformations.
- Host: GitHub
- URL: https://github.com/shopstic/k8s-resource-replicator
- Owner: shopstic
- License: apache-2.0
- Created: 2021-02-02T08:13:16.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-25T18:30:48.000Z (over 3 years ago)
- Last Synced: 2025-01-06T18:46:43.240Z (9 months ago)
- Topics: configmap, crd, jsonpatch, kubernetes, operator, secrets
- Language: TypeScript
- Homepage:
- Size: 137 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kubernetes Resource Replicator
[](https://github.com/shopstic/k8s-resource-replicator/actions)
[](https://github.com/shopstic/k8s-resource-replicator/blob/main/LICENSE)
[](https://hub.docker.com/repository/docker/shopstic/k8s-resource-replicator/tags?page=1&ordering=last_updated)A very lean and fast Kubernetes operator which enables replication of resources
(e.g `ConfigMap`, `Secret`, etc.) across namespaces. It also supports
[JSON Patch](http://jsonpatch.com/) operations to allow transformation of the
payload with ease.Example of a CRD instance:
```yaml
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.