Skip to content

Commit

Permalink
Add basic readme
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Sep 14, 2020
1 parent 29e4ddc commit 44709c0
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 1 deletion.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# k8s-redis-db-asignment-operator
# Kuberneter Redis Database Assignment Operator

[![Github Actions](https://github.com/WyriHaximusNet/docker-kubernetes-redis-db-assignment-operator/workflows/Continuous%20Integration/badge.svg)](https://github.com/wyrihaximusnet/docker-kubernetes-redis-db-assignment-operator/actions)
[![Docker hub](https://img.shields.io/badge/Docker%20Hub-00a5c9.svg?logo=docker&style=flat&color=00a5c9&labelColor=00a5c9&logoColor=white)](https://hub.docker.com/r/wyrihaximusnet/kubernetes-redis-db-assignment-operator/)
[![Docker hub](https://img.shields.io/docker/pulls/wyrihaximusnet/kubernetes-redis-db-assignment-operator.svg?color=00a5c9&labelColor=03566a)](https://hub.docker.com/r/wyrihaximusnet/kubernetes-redis-db-assignment-operator/)
[![Docker hub](https://img.shields.io/microbadger/image-size/wyrihaximusnet/kubernetes-redis-db-assignment-operator/7.4-zts-alpine3.12.svg?color=00a5c9&labelColor=03566a)](https://hub.docker.com/r/wyrihaximusnet/kubernetes-redis-db-assignment-operator/)

## Usage

Suggested usage is to use [`Helm`](https://hub.helm.sh/charts/wyrihaximusnet/redis-db-assignment-operator) to install this operator:

```bash
helm repo add WyriHaximusNet https://helm.wyrihaximus.net/
helm repo update
helm upgrade redis-db-assignment-operator WyriHaximusNet/redis-db-assignment-operator --install --wait --atomic --namespace=redis
```

After the Helm install following definition will create a redis-database resource on your cluster. The operator picks
it up and finds a redis database that isn't in use according to the operators internal state.

```yaml
apiVersion: wyrihaximus.net/v1
kind: RedisDatabase
metadata:
name: example
spec:
secret:
name: example-redis-database
service:
read: redis://redis-follower.redis.svc.cluster.local:6379/
write: redis://redis-leader.redis.svc.cluster.local:6379/
```
The resulting secret looks like this:
```yaml
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: example-redis-database
namespace: default
data:
DATABASE: BASE64_ENCODED
READ: BASE64_ENCODED
WRITE: BASE64_ENCODED
```
10 changes: 10 additions & 0 deletions crd/v1-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: wyrihaximus.net/v1
kind: RedisDatabase
metadata:
name: example
spec:
secret:
name: example-redis-database
service:
read: redis://redis-follower.redis.svc.cluster.local:6379/
write: redis://redis-leader.redis.svc.cluster.local:6379/
44 changes: 44 additions & 0 deletions crd/v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: redis-databases.wyrihaximus.net
spec:
group: wyrihaximus.net
scope: Namespaced
names:
plural: redis-databases
singular: redis-database
kind: RedisDatabase
categories: [ redis ]
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required: [secret, service]
properties:
secret:
type: object
required: [name]
properties:
name:
type: string
nullable: false
description: The name of the secret to create with the connection details
service:
type: object
required: [read, write]
properties:
read:
type: string
nullable: false
description: Read access service
write:
type: string
nullable: false
description: Write access service

0 comments on commit 44709c0

Please sign in to comment.