k8s-replicator

module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2022 License: Apache-2.0

README

Kubernetes Replicator

Main Branch Build codecov Vulnerabilities Scan License

Release Docker Image Docker Pulls

Replicator supports copying kubernetes resources across namespaces. This controller was written keeping extensibility and performance in mind. Therefore, it can be extended to any other resource as needed. The following resources are supported by the Kubernetes replicator.

  • Secrets
  • Config Maps
  • Network Policies

How to Use

How to Setup Controller
Quickstart

Run the following command to apply the controller to your cluster. The <VERSION> should be replaced with the release version to be used (eg:- 0.3.0) and kubectl CLI should be configured pointing to the cluster in which the controller needs to be started.

curl -L https://raw.githubusercontent.com/nadundesilva/k8s-replicator/main/installers/install.sh | bash -s <VERSION>
Manual Installation
  • Clone this repository and checkout the required version of K8s Replicator.

  • Update the configuration (<REPOSITORY_ROOT>/kustomize/config.yaml) to match your needs.

  • Apply the controller into your cluster by running the following command.

    kubectl apply -k kustomize
    
How to mark a object to be replicated

Use the following label to mark the object to be replicated.

replicator.nadundesilva.github.io/object-type=source

All objects with the above label will replicated into all namespaces.

Ignored namespaces

The following namespaces are ignored by default.

  • The namespace in which controller resides
  • Namespaces with the name starting with kube- prefix
  • Namespaces with the label
    replicator.nadundesilva.github.io/namespace-type=ignored
    

If you want to override this behavior and specifically replicate to a namespace, add the following label

replicator.nadundesilva.github.io/namespace-type=managed
Examples

Examples based on the K8s Replicator can be found here.

Additional labels/annotations used by the controller

The folloing labels are used by the controller to track the replication of resources.

  • The following label with the value replica is used to mark the replicated objects.
    replicator.nadundesilva.github.io/object-type=replica
    
  • The following annotation is used to store a replicated resource's source namespace.
    replicator.nadundesilva.github.io/source-namespace=<namespace>
    
  • The following annotation is used to store a replicated resource's source resource version.
    replicator.nadundesilva.github.io/source-resource-version=<resource-version>
    
How to Cleanup Controller
Quick Remove

Run 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.

Note: This approach would only work if you used the Quickstart option for setting up the controller.

curl -L https://raw.githubusercontent.com/nadundesilva/k8s-replicator/main/installers/uninstall.sh | bash -s
Manual Removal
  • Clone this repository and checkout the installed version of K8s Replicator.

  • Remove the controller from your cluster by running the following command.

    kubectl delete -k kustomize
    

Support

❔ If you need support or have a question about the K8s Replicator, reach out through Discussions.

🐛 If you have found a bug and would like to get it fixed, try opening a Bug Report.

💡 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.

Directories

Path Synopsis
cmd
replicator
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
pkg
config
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
kubernetes
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
replicator
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
replicator/resources
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
signals
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
version
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
test
benchmark
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
e2e
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
utils/cleanup
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
utils/controller
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
utils/namespaces
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
utils/resources
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.
utils/validation
* Copyright (c) 2022, Nadun De Silva.
* Copyright (c) 2022, Nadun De Silva.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL