k8s-replicator

command module
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

K8s Replicator

Main Branch Build 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

Prerequisites

The following tools are expected to be installed and ready.

  • Kubectl
  • Operator SDK

The following tools can be either installed on your own or let the installation scripts handle it.

  • OLM to be installed in the cluster OLM can be installed using the operator-sdk
    operator-sdk olm install
    
How to Setup Operator
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.1.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
  • Make sure all the pre-requisites are installed (including the dependencies which are normally installed by the installation scripts)
  • Install the Operator Bundle using the Operator SDK. The <VERSION> should be replaced with the release version 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.
    operator-sdk run bundle docker.io/nadunrds/k8s-replicator-bundle:<VERSION>
    
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=replicated

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 for the CRDs used by the Operator can be found in the samples directory.

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>
    
How to Cleanup Operator
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.

curl -L https://raw.githubusercontent.com/nadundesilva/k8s-replicator/main/installers/uninstall.sh | bash -s
Manual Removal

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

operator-sdk cleanup k8s-replicator

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
* 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/gomega
* Copyright (c) 2023, Nadun De Silva.
* Copyright (c) 2023, 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