Skip to content

Commit 8e42f50

Browse files
committed
update readme
1 parent 1aa3d44 commit 8e42f50

File tree

4 files changed

+154
-3
lines changed

4 files changed

+154
-3
lines changed

README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,32 @@ The operator itself is built with the [Operator framework](https://github.com/op
1111
Each master node and its slave nodes is managed by a statefulSet, create a headless svc for each statefulSet,
1212
and create a clusterIP service for all nodes.
1313

14+
Each statefulset uses PodAntiAffinity to ensure that the master and slaves are dispersed on different nodes.
15+
At the same time, when the operator selects the master in each statefulset, it preferentially select the pod
16+
with different k8s nodes as master.
17+
18+
Table of Contents
19+
=================
20+
21+
* [redis-cluster-operator](#redis-cluster-operator)
22+
* [Overview](#overview)
23+
* [Prerequisites](#prerequisites)
24+
* [Features](#features)
25+
* [Quick Start](#quick-start)
26+
* [Deploy redis cluster operator](#deploy-redis-cluster-operator)
27+
* [Deploy a sample Redis Cluster](#deploy-a-sample-redis-cluster)
28+
* [Scaling Up the Redis Cluster](#scaling-up-the-redis-cluster)
29+
* [Scaling Down the Redis Cluster](#scaling-down-the-redis-cluster)
30+
* [Backup and Restore](#backup-and-restore)
31+
* [Prometheus Discovery](#prometheus-discovery)
32+
* [Create Redis Cluster with password](#create-redis-cluster-with-password)
33+
* [Persistent Volume](#persistent-volume)
34+
* [Custom Configuration](#custom-configuration)
35+
* [Custom Service](#custom-service)
36+
* [Custom Resource](#custom-resource)
37+
* [ValidatingWebhook](#validatingwebhook)
38+
* [End to end tests](#end-to-end-tests)
39+
1440
## Prerequisites
1541

1642
* go version v1.13+.
@@ -32,7 +58,6 @@ and create a clusterIP service for all nodes.
3258

3359
- __Prometheus Discovery__
3460

35-
3661
## Quick Start
3762

3863
### Deploy redis cluster operator
@@ -143,7 +168,7 @@ spec:
143168

144169
#### Backup and Restore
145170

146-
**Only Ceph object storage is supported now**
171+
**Only Ceph object storage is supported now**
147172

148173
Backup
149174
```
@@ -189,4 +214,12 @@ $ kubectl create -f deploy/example/custom-service.yaml
189214

190215
```
191216
$ kubectl create -f deploy/example/custom-resources.yaml
192-
```
217+
```
218+
219+
## ValidatingWebhook
220+
221+
see [ValidatingWebhook](/hack/webhook/README.md)
222+
223+
## End to end tests
224+
225+
see [e2e](/test/e2e/README.md)

hack/webhook/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ValidatingWebhook for distributedredisclusters
2+
3+
## Prerequisites
4+
5+
Kubernetes with the `admissionregistration.k8s.io/v1beta1` API enabled. Verify that by the following command:
6+
```
7+
kubectl api-versions | grep admissionregistration.k8s.io/v1beta1
8+
```
9+
The result should be:
10+
```
11+
admissionregistration.k8s.io/v1beta1
12+
```
13+
14+
In addition, the `MutatingAdmissionWebhook` and `ValidatingAdmissionWebhook` admission controllers should be added and listed in the correct order in the admission-control flag of kube-apiserver.
15+
16+
## Deploy
17+
18+
1. Create a signed cert/key pair and store it in a Kubernetes `secret` that will be consumed by operator deployment
19+
```
20+
./create-signed-cert.sh --service drc-admission-webhook --secret drc-webhook-cert --namespace default
21+
```
22+
23+
2. Patch the `ValidatingWebhookConfiguration` by set `caBundle` with correct value from Kubernetes cluster
24+
```
25+
cat validatingwebhook.yaml | \
26+
patch-ca-bundle.sh > \
27+
validatingwebhook-ca-bundle.yaml
28+
```
29+
30+
3. Deploy resources
31+
```
32+
kubectl delete -f operator.yml
33+
kubectl create -f operator.yml
34+
kubectl create -f validatingwebhook-ca-bundle.yaml
35+
kubectl create -f service.yaml
36+
```

hack/webhook/operator.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: redis-cluster-operator
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
name: redis-cluster-operator
10+
template:
11+
metadata:
12+
labels:
13+
name: redis-cluster-operator
14+
spec:
15+
serviceAccountName: redis-cluster-operator
16+
containers:
17+
- name: redis-cluster-operator
18+
image: uhub.service.ucloud.cn/operator/redis-cluster-operator:latest
19+
command:
20+
- redis-cluster-operator
21+
args:
22+
- --zap-level=4
23+
- --zap-time-encoding=iso8601
24+
- --ctr-maxconcurrent=10
25+
- --rename-command-path=/etc/redisconf
26+
- --rename-command-file=redis.conf
27+
imagePullPolicy: Always
28+
resources:
29+
limits:
30+
cpu: "2"
31+
memory: 2000Mi
32+
requests:
33+
cpu: 500m
34+
memory: 500Mi
35+
env:
36+
- name: WATCH_NAMESPACE
37+
value: ""
38+
- name: ENABLE_WEBHOOKS
39+
value: "true"
40+
- name: POD_NAME
41+
valueFrom:
42+
fieldRef:
43+
fieldPath: metadata.name
44+
- name: OPERATOR_NAME
45+
value: "redis-cluster-operator"
46+
volumeMounts:
47+
- name: redisconf
48+
mountPath: /etc/redisconf
49+
- name: webhook-certs
50+
mountPath: /etc/webhook/certs
51+
readOnly: true
52+
volumes:
53+
- name: redisconf
54+
configMap:
55+
name: redis-admin
56+
- name: webhook-certs
57+
secret:
58+
secretName: drc-webhook-cert
59+
---
60+
apiVersion: v1
61+
kind: ConfigMap
62+
metadata:
63+
name: redis-admin
64+
data:
65+
redis.conf: |-
66+
rename-command CONFIG lni07z1p
67+
rename-command BGSAVE pp14qluk
68+
rename-command DEBUG 8a4insyv
69+
rename-command SAVE 6on30p6z
70+
rename-command SHUTDOWN dvui0opr
71+
rename-command SLAVEOF xwxvcw36
72+
rename-command BGREWRITEAOF www07fko
73+
rename-command FLUSHDB dfqw3rsf
74+
rename-command FLUSHALL zvsdf2ff

test/e2e/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# End to end tests for DistributedRedisCluster and RedisClusterBackup
2+
3+
## Run test in Kubernetes
4+
5+
`kubectl create -f deploy/e2e.yml`
6+
7+
## Build and push e2e test images
8+
` DOCKER_REGISTRY=your_registry make push-e2e`

0 commit comments

Comments
 (0)