-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29e4ddc
commit 44709c0
Showing
4 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,47 @@ | ||
# k8s-redis-db-asignment-operator | ||
# Kuberneter Redis Database Assignment Operator | ||
|
||
[](https://github.com/wyrihaximusnet/docker-kubernetes-redis-db-assignment-operator/actions) | ||
[](https://hub.docker.com/r/wyrihaximusnet/kubernetes-redis-db-assignment-operator/) | ||
[](https://hub.docker.com/r/wyrihaximusnet/kubernetes-redis-db-assignment-operator/) | ||
[](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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |