{"id":29161062,"url":"https://github.com/nadundesilva/k8s-replicator","last_synced_at":"2025-07-01T03:07:43.821Z","repository":{"id":41851605,"uuid":"470677387","full_name":"nadundesilva/k8s-replicator","owner":"nadundesilva","description":"Replicator for Kubernetes resources","archived":false,"fork":false,"pushed_at":"2024-10-23T09:24:45.000Z","size":531,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-23T13:57:56.736Z","etag":null,"topics":["controller","copy","kubernetes","reflect","replicate"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nadundesilva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-16T17:02:51.000Z","updated_at":"2024-10-18T10:16:09.000Z","dependencies_parsed_at":"2024-06-21T00:04:58.967Z","dependency_job_id":"f5733764-954f-4d21-a42a-e44c3115f494","html_url":"https://github.com/nadundesilva/k8s-replicator","commit_stats":{"total_commits":207,"total_committers":1,"mean_commits":207.0,"dds":0.0,"last_synced_commit":"00559ec301669a43d1777b39839ea09175a5d3b4"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/nadundesilva/k8s-replicator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadundesilva%2Fk8s-replicator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadundesilva%2Fk8s-replicator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadundesilva%2Fk8s-replicator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadundesilva%2Fk8s-replicator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nadundesilva","download_url":"https://codeload.github.com/nadundesilva/k8s-replicator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadundesilva%2Fk8s-replicator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262887201,"owners_count":23379768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["controller","copy","kubernetes","reflect","replicate"],"created_at":"2025-07-01T03:07:43.053Z","updated_at":"2025-07-01T03:07:43.792Z","avatar_url":"https://github.com/nadundesilva.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# K8s Replicator\n\n[![Main Branch Build](https://github.com/nadundesilva/k8s-replicator/actions/workflows/branch-build.yaml/badge.svg)](https://github.com/nadundesilva/k8s-replicator/actions/workflows/branch-build.yaml)\n[![Vulnerabilities Scan](https://github.com/nadundesilva/k8s-replicator/actions/workflows/vulnerabilities-scan.yaml/badge.svg)](https://github.com/nadundesilva/k8s-replicator/actions/workflows/vulnerabilities-scan.yaml)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n[![Release](https://img.shields.io/github/release/nadundesilva/k8s-replicator.svg?style=flat-square)](https://github.com/nadundesilva/k8s-replicator/releases/latest)\n[![Docker Image](https://img.shields.io/docker/image-size/nadunrds/k8s-replicator/latest?style=flat-square)](https://hub.docker.com/r/nadunrds/k8s-replicator)\n[![Docker Pulls](https://img.shields.io/docker/pulls/nadunrds/k8s-replicator?style=flat-square)](https://hub.docker.com/r/nadunrds/k8s-replicator)\n\nReplicator supports copying kubernetes resources across namespaces. This controller was written keeping extensibility and [performance](./BENCHMARK.md) in mind. Therefore, it can be extended to any other resource as needed. The following resources are supported by the Kubernetes replicator.\n\n* Secrets\n* Config Maps\n* Network Policies\n\n## How to Use\n\n### Prerequisites\n\nThe following tools are expected to be installed and ready.\n- Kubectl\n- Operator SDK\n\nThe following tools can be either installed on your own or let the installation scripts handle it.\n- OLM to be installed in the cluster\n  OLM can be installed using the [operator-sdk](https://sdk.operatorframework.io/docs/installation/)\n  ```bash\n  operator-sdk olm install\n  ```\n\n### How to Setup Operator\n\n#### Quickstart\n\nRun the following command to apply the controller to your cluster. The `\u003cVERSION\u003e` should be replaced with the release version\nto be used (eg:- `0.1.0`) and kubectl CLI should be configured pointing to the cluster in which the controller needs to be started.\n\n```bash\ncurl -L https://raw.githubusercontent.com/nadundesilva/k8s-replicator/main/installers/install.sh | bash -s \u003cVERSION\u003e\n```\n\n#### Manual Installation\n\n* Make sure all the pre-requisites are installed (including the dependencies which are normally installed by the installation scripts)\n* Install the Operator Bundle using the Operator SDK. The `\u003cVERSION\u003e` should be replaced with the release version\n  to be used (eg:- `0.1.0`) and kubectl CLI should be configured pointing to the cluster in which the controller needs to be started.\n  ```bash\n  operator-sdk run bundle docker.io/nadunrds/k8s-replicator-bundle:\u003cVERSION\u003e\n  ```\n\n### How to mark a object to be replicated\n\nUse the following label to mark the object to be replicated.\n\n```properties\nreplicator.nadundesilva.github.io/object-type=replicated\n```\n\nAll objects with the above label will replicated into all namespaces.\n\n#### Ignored namespaces\n\nThe following namespaces are ignored by default.\n\n* The namespace in which controller resides\n* Namespaces with the name starting with `kube-` prefix\n* Namespaces with the label\n  ```properties\n  replicator.nadundesilva.github.io/namespace-type=ignored\n  ```\n\nIf you want to override this behavior and specifically replicate to a namespace, add the following label\n\n```properties\nreplicator.nadundesilva.github.io/namespace-type=managed\n```\n\n### Examples\n\nExamples for the CRDs used by the Operator can be found in the [samples](./config/samples) directory.\n\n### Additional labels/annotations used by the controller\n\nThe folloing labels are used by the controller to track the replication of resources.\n\n* The following label with the value `replica` is used to mark the replicated objects.\n  ```properties\n  replicator.nadundesilva.github.io/object-type=replica\n  ```\n* The following annotation is used to store a replicated resource's source namespace.\n  ```properties\n  replicator.nadundesilva.github.io/source-namespace=\u003cnamespace\u003e\n  ```\n\n### How to Cleanup Operator\n\n#### Quick Remove\n\nRun the following command to remove the controller from your cluster. Kubectl CLI should be configured pointing to the cluster in which the controller needs to be started.\n\n```bash\ncurl -L https://raw.githubusercontent.com/nadundesilva/k8s-replicator/main/installers/uninstall.sh | bash -s\n```\n\n#### Manual Removal\n\nRemove the controller from your cluster by running the following command.\n\n```bash\noperator-sdk cleanup k8s-replicator\n```\n\n## How to Extend\n\nThis Operator is created with extensibility in mind. To support this, a common interface `Replicator` was introduced.\n\n```go\ntype Replicator interface {\n GetKind() string\n AddToScheme(scheme *runtime.Scheme) error\n\n EmptyObject() client.Object\n EmptyObjectList() client.ObjectList\n ObjectListToArray(client.ObjectList) []client.Object\n\n Replicate(sourceObject client.Object, targetObject client.Object)\n}\n```\n\nThe K8s Replicator core uses the methods defined in this interface to get, list, and replicate resources to namespaces. The methods are carefully chosen to ensure that the minimum set of functionalities are defined for each resource separately keeping most of the logic reusable in the Operator core.\n\nYou can check the [existing implementations](./controllers/replication/) of `Replicator` to get an idea of what needs to be done. However, you need to build the Operator from the source to get the new `Replicator` up and running. That being said, if you wish to contribute new resource replicators, you are most welcome.\n\n## Support\n\n:grey_question: If you need support or have a question about the K8s Replicator, reach out through [Discussions](https://github.com/nadundesilva/k8s-replicator/discussions).\n\n:bug: If you have found a bug and would like to get it fixed, try opening a [Bug Report](https://github.com/nadundesilva/k8s-replicator/issues/new?labels=Type%2FBug\u0026template=bug-report.md).\n\n:bulb: If you have a new idea or want to get a new feature or improvement added to the K8s Replicator, try creating a [Feature Request](https://github.com/nadundesilva/k8s-replicator/issues/new?labels=Type%2FFeature\u0026template=feature-request.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadundesilva%2Fk8s-replicator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadundesilva%2Fk8s-replicator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadundesilva%2Fk8s-replicator/lists"}