Redis-Operator

command module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

README

PayU Redis Operator

Kubernetes operator that creates and manages Redis HA clustered databases - Redis docs.

Project status: Alpha

The basic features have been completed, and while no breaking API changes are currently planned, the API can change in a backwards incompatible way before the project is declared stable and more features are expected for the stable version

Feature state wiki page

Quick start

How to update the crd:

make install

How to update the manager/controller code:

make manager

How to deploy the controller to a cluster (using the current context):

make deploy


Using a local cluster

For testing the Redis operator on a local kind cluster:

cd hack
python gen_kind_config.py # creates a new kind cluster config file
sh ./install.sh # you might need to run this as sudo if a regular user can't use docker

If the .kube/config file was not updated it can be populated using

kind --name redis-test get kubeconfig > ~/.kube/config

After having a running kind cluster we should install the operator crd.

 cd ..
 make install

After having a running kind cluster the operator can be deployed using

make deploy LOCAL=true NOTEST=true

A development operator YAML file can be found in Redis-Operator/config/samples/local_cluster.yaml, apply it to the cluster after the operator deployment is up with:

kubectl apply -f config/samples/local_cluster.yaml


Quick development using Telepresence

To develop directly on a deployed operator without rebuilding and loading/deploying the image you need to have access to a cluster (can be remote or local) and Telepresence tool.

Note: If this is your first time using Telepresence you should make sure it has the right system permissions to work properly.

  1. Build the development image:

make docker-build-dev NOTEST=true

  1. Swap the dev image with the operator deploy using Telepresence
telepresence --mount /tmp/podtoken  --context kind-redis-test --namespace infra --swap-deployment redis-operator-controller-manager --docker-run --rm -it -v $(pwd):/app -v=/tmp/podtoken/var/run/secrets:/var/run/secrets redis-operator:dev

How it works

While the image used for production and local deployment is optimised for size, the development image does not discard the environment tools and allows the operator controller binary to be compiled inside the container. The image uses the CompileDaemon Go module in the ENTRYPOINT to track the source files, compile and build the controller. Every time the source files change a build and run are triggered.

The source code directory is mounted at /app and a special directory /var/run/secrets is used to load the permissions of the deployment that is being swapped. For more information check the Telepresence documentation Link1 & Link2.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1
Package v1 contains API Schema definitions for the db v1 API group +kubebuilder:object:generate=true +groupName=db.payu.com
Package v1 contains API Schema definitions for the db v1 API group +kubebuilder:object:generate=true +groupName=db.payu.com
test
e2e

Jump to

Keyboard shortcuts

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