Skip to content

Commit

Permalink
198-bootstrap update README and add example files
Browse files Browse the repository at this point in the history
  • Loading branch information
alecjacobs5401 committed Feb 28, 2020
1 parent 70b9697 commit 4e2ccdf
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,32 @@ spec:
```
You need to set secretPath as the secret name which is created before.

### Bootstrapping from pre-existing Redis Instance(s)
If you are wanting to migrate off of a pre-existing Redis instance, you can provide a `bootstrapNode` to your `RedisFailover` resource spec.

This `bootstrapNode` can be configured as follows:
| Key | Type | Description | Example File |
|:--------------:|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
| host | **required** | The IP of the target Redis address or the ClusterIP of a pre-existing Kubernetes Service targeting Redis pods | [bootstrapping.yaml](example/redisfailover/bootstrapping.yaml) |
| port | _optional_ | The Port that the target Redis address is listening to. Defaults to `6379`. | [bootstrapping-with-port.yaml](example/redisfailover/bootstrapping-with-port.yaml) |
| allowSentinels | _optional_ | Allow the Operator to also create the specified Sentinel resources and point them to the target Node/Port. By default, the Sentinel resources will **not** be created when bootstrapping. | [bootstrapping-with-sentinels.yaml](example/redisfailover/bootstrapping-with-sentinels.yaml) |

#### What is Bootstrapping?
When a `bootstrapNode` is provided, the Operator will always set all of the defined Redis instances to replicate from the provided `bootstrapNode` host value.
This allows for defining a `RedisFailover` that replicates from an existing Redis instance to ease cutover from one instance to another.

**Note: Redis instance will always be configured with `replica-priority 0`. This means that these Redis instances can _never_ be promoted to a `master`.**

Depending on the configuration provided, the Operator will launch the `RedisFailover` in two bootstrapping states: without sentinels and with sentinels.

#### Default Bootstrapping Mode (Without Sentinels)
By default, if the `RedisFailover` resource defines a valid `bootstrapNode`, **only the redis instances will be created**.
This allows for ease of bootstrapping from an existing `RedisFailover` instance without the Sentinels intermingling with each other.

#### Bootstrapping With Sentinels
When `allowSentinels` is provided, the Operator will also create the defined Sentinel resources. These sentinels will be configured to point to the provided
`bootstrapNode` as their monitored master.

## Cleanup

### Operator and CRD
Expand Down
12 changes: 12 additions & 0 deletions example/redisfailover/bootstrapping-with-port.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
name: redisfailover
spec:
bootstrapNode:
host: "127.0.0.1"
port: 6388
sentinel:
replicas: 3
redis:
replicas: 3
12 changes: 12 additions & 0 deletions example/redisfailover/bootstrapping-with-sentinels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
name: redisfailover
spec:
bootstrapNode:
host: "127.0.0.1"
allowSentinels: true
sentinel:
replicas: 3
redis:
replicas: 3
11 changes: 11 additions & 0 deletions example/redisfailover/bootstrapping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
name: redisfailover
spec:
bootstrapNode:
host: "127.0.0.1"
sentinel:
replicas: 3
redis:
replicas: 3

0 comments on commit 4e2ccdf

Please sign in to comment.