Skip to content

Commit

Permalink
Merge pull request #349 from iamabhishek-dubey/redis-v7
Browse files Browse the repository at this point in the history
[Development][Add] Added support for redis v7
  • Loading branch information
sandy724 authored Oct 17, 2022
2 parents 8de4f15 + 6398f49 commit 9b80bd5
Show file tree
Hide file tree
Showing 36 changed files with 421 additions and 314 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
### v0.12.0
##### October 12, 2022

#### :beetle: Bug Fixes

- PDB (Pod disruption budget) creation issue
- Fixed cluster recovery logic
- Fixed IP check and conversion logic
- Persistence issue fix

#### :tada: Features

- Added pvc, pv clusterrole fix
- Support for defining serviceAccount
- Closing of redis client connection
- Added finalizer for statefulset
- Added Prometheus service annotation
- Added support for Redis 7 with DNS hostname

### v0.11.0
##### July 5, 2022

Expand Down
22 changes: 13 additions & 9 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 0.8.0 | :white_check_mark: |
| 0.7.0 | :white_check_mark: |
| 0.6.0 | :white_check_mark: |
| 0.5.0 | :x: |
| 0.4.0 | :x: |
| 0.3.0 | :x: |
| 0.2.0 | :x: |
| 0.1.0 | :x: |
|---------|--------------------|
| 0.12.0 | :white_check_mark: |
| 0.11.0 | :white_check_mark: |
| 0.10.0 | :x: |
| 0.9.0 | :x: |
| 0.8.0 | :x: |
| 0.7.0 | :x: |
| 0.6.0 | :x: |
| 0.5.0 | :x: |
| 0.4.0 | :x: |
| 0.3.0 | :x: |
| 0.2.0 | :x: |
| 0.1.0 | :x: |


## Reporting a Vulnerability
Expand Down
14 changes: 10 additions & 4 deletions api/v1beta1/rediscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
type RedisClusterSpec struct {
Size *int32 `json:"clusterSize"`
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"`
// +kubebuilder:default:=v7
ClusterVersion *string `json:"clusterVersion,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
RedisLeader RedisLeader `json:"redisLeader,omitempty"`
// +kubebuilder:default:={livenessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}, readinessProbe:{initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}}
Expand Down Expand Up @@ -58,8 +60,10 @@ type RedisLeader struct {
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
}

// RedisFollower interface will have the redis follower configuration
Expand All @@ -68,8 +72,10 @@ type RedisFollower struct {
RedisConfig *RedisConfig `json:"redisConfig,omitempty"`
Affinity *corev1.Affinity `json:"affinity,omitempty"`
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"`
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"`
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3}
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"`
}

// RedisClusterStatus defines the observed state of RedisCluster
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions config/crd/bases/redis.redis.opstreelabs.in_redisclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
clusterSize:
format: int32
type: integer
clusterVersion:
default: v7
type: string
kubernetesConfig:
description: KubernetesConfig will be the JSON struct for Basic Redis
Config
Expand Down Expand Up @@ -1232,6 +1235,12 @@ spec:
type: object
type: object
livenessProbe:
default:
failureThreshold: 3
initialDelaySeconds: 1
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
description: Probe is a interface for ReadinessProbe and LivenessProbe
properties:
failureThreshold:
Expand Down Expand Up @@ -1274,6 +1283,12 @@ spec:
type: integer
type: object
readinessProbe:
default:
failureThreshold: 3
initialDelaySeconds: 1
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
description: Probe is a interface for ReadinessProbe and LivenessProbe
properties:
failureThreshold:
Expand Down Expand Up @@ -2195,6 +2210,12 @@ spec:
type: object
type: object
livenessProbe:
default:
failureThreshold: 3
initialDelaySeconds: 1
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
description: Probe is a interface for ReadinessProbe and LivenessProbe
properties:
failureThreshold:
Expand Down Expand Up @@ -2237,6 +2258,12 @@ spec:
type: integer
type: object
readinessProbe:
default:
failureThreshold: 3
initialDelaySeconds: 1
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
description: Probe is a interface for ReadinessProbe and LivenessProbe
properties:
failureThreshold:
Expand Down
1 change: 1 addition & 0 deletions docs/src/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Here the features which are supported by this operator:-
- Tolerations
- SecurityContext
- Storage
- ServiceAccount

## Architecture

Expand Down
30 changes: 30 additions & 0 deletions docs/src/guide/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
### v0.12.0
##### October 12, 2022

**:beetle: Bug Fixes**

- PDB (Pod disruption budget) creation issue
- Fixed cluster recovery logic
- Fixed IP check and conversion logic
- Persistence issue fix

**:tada: Features**

- Added pvc, pv clusterrole fix
- Support for defining serviceAccount
- Closing of redis client connection
- Added finalizer for statefulset
- Added Prometheus service annotation
- Added support for Redis 7 with DNS hostname

### v0.11.0
**July 5, 2022**

**:beetle: Bug Fixes**

- Fix Redis cluster and Redis CRD
- Fixed TLS authentication between redis cluster
- Fixed RBAC policy for PDB
- Redis exporter exception handled
- External service fix

### v0.10.0
**January 26, 2022**

Expand Down
20 changes: 10 additions & 10 deletions docs/src/guide/failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@
Before failover testing, we have to write some dummy data inside the Redis cluster, we can write the dummy data using the `redis-cli`.

```shell
$ kubectl exec -it redis-leader-0 -n redis-operator \
$ kubectl exec -it redis-leader-0 -n ot-operators \
-- redis-cli -a Opstree@1234 -c set tony stark
...
Defaulting container name to redis-leader.
Use 'kubectl describe pod/redis-leader-0 -n redis-operator' to see all of the containers in this pod.
Use 'kubectl describe pod/redis-leader-0 -n ot-operatorsr' to see all of the containers in this pod.
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
OK
```

Verify the key has been inserted properly by fetching its value.

```shell
$ kubectl exec -it redis-leader-0 -n redis-operator \
$ kubectl exec -it redis-leader-0 -n ot-operators \
-- redis-cli -a Opstree@1234 -c get tony
...
Use 'kubectl describe pod/redis-leader-0 -n redis-operator' to see all of the containers in this pod.
Use 'kubectl describe pod/redis-leader-0 -n ot-operators' to see all of the containers in this pod.
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
"stark"
```

Let’s restart the pod name `redis-leader-0` and see the redis node behavior.

```shell
$ kubectl delete pod redis-leader-0 -n redis-operator
$ kubectl delete pod redis-leader-0 -n ot-operators
...
pod "redis-leader-0" deleted
```

Now we can again try to list redis cluster nodes from `redis-leader-0` pod and from some other pod as well like:- `redis-follower-2`

```shell
$ kubectl exec -it redis-leader-0 -n redis-operator \
$ kubectl exec -it redis-leader-0 -n ot-operators \
-- redis-cli -a Opstree@1234 cluster nodes
...
Defaulting container name to redis-leader.
Use 'kubectl describe pod/redis-leader-0 -n redis-operator' to see all of the containers in this pod.
Use 'kubectl describe pod/redis-leader-0 -n ot-operators' to see all of the containers in this pod.
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
eef84b7dada737051c32d592bd66652b9af0cb35 10.42.2.184:6379@16379 slave 0a36dc5064b0a61afa8bd850e93ff0a1c2267704 0 1619958171517 3 connected
a7c424b5ec0e696aa7be15a691846c8820e48cd1 10.42.1.181:6379@16379 master - 0 1619958172520 4 connected 0-5460
Expand All @@ -50,14 +50,14 @@ a7c424b5ec0e696aa7be15a691846c8820e48cd1 10.42.1.181:6379@16379 master - 0 16199

So if you notice the output of cluster nodes command, the node IP is updated and it’s connected as a leader.

Let's try to get value of key from some other pod
Let's try to get value of key from some other pods

```shell
$ kubectl exec -it redis-follower-1 -n redis-operator \
$ kubectl exec -it redis-follower-1 -n ot-operators \
-- redis-cli -a Opstree@1234 -c get tony
...
Defaulting container name to redis-follower.
Use 'kubectl describe pod/redis-follower-1 -n redis-operator' to see all of the containers in this pod.
Use 'kubectl describe pod/redis-follower-1 -n ot-operators' to see all of the containers in this pod.
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
"stark"
```
6 changes: 3 additions & 3 deletions docs/src/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ The easiest way to install a redis operator is using Helm chart. The operator he
```shell
$ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
$ helm upgrade redis-operator ot-helm/redis-operator \
--install --namespace redis-operator
--install --namespace ot-operators
...
Release "redis-operator" does not exist. Installing it now.
NAME: redis-operator
LAST DEPLOYED: Sun May 2 14:42:23 2021
NAMESPACE: redis-operator
NAMESPACE: ot-operators
STATUS: deployed
REVISION: 1
TEST SUITE: None
Expand All @@ -27,7 +27,7 @@ TEST SUITE: None
Check the state of the pod is running or not.

```shell
$ kubectl get pods -n redis-operator
$ kubectl get pods -n ot-operators
...
NAME READY STATUS RESTARTS AGE
redis-operator-74b6cbf5c5-td8t7 1/1 Running 0 2m11s
Expand Down
Loading

0 comments on commit 9b80bd5

Please sign in to comment.