Skip to content

Commit 6fcbc37

Browse files
committed
use inclusive naming
Replace the terms whitelist and blacklist with allowlist and blocklist respectively. Uses of the term whitelist have been replaced with the more descriptive term "propagateLabels". https://inclusivenaming.org/word-lists/tier-1/whitelist/ Fixes spotahome#593
1 parent bc1d9cf commit 6fcbc37

File tree

9 files changed

+1302
-173
lines changed

9 files changed

+1302
-173
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,4 @@ generate-crd:
201201
-e CRD_OUT_PATH=/go/src/$(PROJECT_PACKAGE)/manifests \
202202
$(CODEGEN_IMAGE) update-crd.sh
203203
cp -f manifests/databases.spotahome.com_redisfailovers.yaml manifests/kustomize/base
204+
cp -f manifests/databases.spotahome.com_redisfailovers.yaml charts/redisoperator/crds

README.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ It can be done with plain old [deployment](example/operator), using [Kustomize](
2222

2323
From the root folder of the project, execute the following:
2424

25-
```
25+
```sh
2626
helm repo add redis-operator https://spotahome.github.io/redis-operator
2727
helm repo update
2828
helm install redis-operator redis-operator/redis-operator
@@ -32,19 +32,20 @@ helm install redis-operator redis-operator/redis-operator
3232

3333
Helm chart only manage the creation of CRD in the first install. In order to update the CRD you will need to apply directly.
3434

35-
```
35+
```sh
3636
REDIS_OPERATOR_VERSION=v1.2.4
3737
kubectl replace -f https://raw.githubusercontent.com/spotahome/redis-operator/${REDIS_OPERATOR_VERSION}/manifests/databases.spotahome.com_redisfailovers.yaml
3838
```
3939

40-
```
40+
```sh
4141
helm upgrade redis-operator redis-operator/redis-operator
4242
```
43+
4344
### Using kubectl
4445

4546
To create the operator, you can directly create it with kubectl:
4647

47-
```
48+
```sh
4849
REDIS_OPERATOR_VERSION=v1.2.4
4950
kubectl create -f https://raw.githubusercontent.com/spotahome/redis-operator/${REDIS_OPERATOR_VERSION}/manifests/databases.spotahome.com_redisfailovers.yaml
5051
kubectl apply -f https://raw.githubusercontent.com/spotahome/redis-operator/${REDIS_OPERATOR_VERSION}/example/operator/all-redis-operator-resources.yaml
@@ -97,7 +98,7 @@ Once the operator is deployed inside a Kubernetes cluster, a new API will be acc
9798
9899
In order to deploy a new redis-failover a [specification](example/redisfailover/basic.yaml) has to be created:
99100
100-
```
101+
```sh
101102
REDIS_OPERATOR_VERSION=v1.2.4
102103
kubectl create -f https://raw.githubusercontent.com/spotahome/redis-operator/${REDIS_OPERATOR_VERSION}/example/redisfailover/basic.yaml
103104
```
@@ -173,35 +174,42 @@ By default, redis and sentinel will be called with the basic command, giving the
173174
If necessary, this command can be changed with the `command` option inside redis/sentinel spec. An example can be found in the [custom command example file](example/redisfailover/custom-command.yaml).
174175

175176
### Custom Priority Class
177+
176178
In order to use a custom Kubernetes [Priority Class](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass) for Redis and/or Sentinel pods, you can set the `priorityClassName` in the redis/sentinel spec, this attribute has no default and depends on the specific cluster configuration. **Note:** the operator doesn't create the referenced `Priority Class` resource.
177179

178180
### Custom Service Account
181+
179182
In order to use a custom Kubernetes [Service Account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) for Redis and/or Sentinel pods, you can set the `serviceAccountName` in the redis/sentinel spec, if not specified the `default` Service Account will be used. **Note:** the operator doesn't create the referenced `Service Account` resource.
180183

181184
### Custom Pod Annotations
185+
182186
By default, no pod annotations will be applied to Redis nor Sentinel pods.
183187

184188
In order to apply custom pod Annotations, you can provide the `podAnnotations` option inside redis/sentinel spec. An example can be found in the [custom annotations example file](example/redisfailover/custom-annotations.yaml).
189+
185190
### Custom Service Annotations
191+
186192
By default, no service annotations will be applied to the Redis nor Sentinel services.
187193

188194
In order to apply custom service Annotations, you can provide the `serviceAnnotations` option inside redis/sentinel spec. An example can be found in the [custom annotations example file](example/redisfailover/custom-annotations.yaml).
189195

190-
### Control of label propagation.
196+
### Control of label propagation
197+
191198
By default the operator will propagate all labels on the CRD down to the resources that it creates. This can be problematic if the
192199
labels on the CRD are not fully under your own control (for example: being deployed by a gitops operator)
193-
as a change to a labels value can fail on immutable resources such as PodDisruptionBudgets. To control what labels the operator propagates
194-
to resource is creates you can modify the labelWhitelist option in the spec.
200+
as a change to a labels value can fail on immutable resources such as PodDisruptionBudgets. To control what labels the operator propagates
201+
to resource is creates you can modify the `propagateLabels` option in the spec.
195202

196-
By default specifying no whitelist or an empty whitelist will cause all labels to still be copied as not to break backwards compatibility.
203+
All labels will be propagated unless otherwise specified.
197204

198205
Items in the array should be regular expressions, see [here](example/redisfailover/control-label-propagation.yaml) as an example of how they can be used and
199206
[here](https://github.com/google/re2/wiki/Syntax) for a syntax reference.
200207

201-
The whitelist can also be used as a form of blacklist by specifying a regular expression that will not match any label.
208+
The allowlist can also be used as a form of blocklist by specifying a regular expression that will not match any label.
202209

203-
NOTE: The operator will always add the labels it requires for operation to resources. These are the following:
204-
```
210+
NOTE: The operator will always add the labels it requires for operation to resources. These are the following:
211+
212+
```yaml
205213
app.kubernetes.io/component
206214
app.kubernetes.io/managed-by
207215
app.kubernetes.io/name
@@ -213,12 +221,13 @@ redisfailovers.databases.spotahome.com/name
213221
### ExtraVolumes and ExtraVolumeMounts
214222

215223
If the user choose to have extra volumes creates and mounted, he could use the `extraVolumes` and `extraVolumeMounts`, in `spec.redis` of the CRD. This allows users to mount the extra configurations, or secrets to be used. A typical use case for this might be
224+
216225
- Secrets that sidecars might use to backup of RDBs
217226
- Extra users and their secrets and acls that could used the initContainers to create multiple users
218227
- Extra Configurations that could merge on top the existing configurations
219228
- To pass failover scripts for addition for additional operations
220229

221-
```
230+
```yaml
222231
---
223232
apiVersion: v1
224233
kind: Secret
@@ -259,14 +268,12 @@ spec:
259268
readOnly: true
260269
```
261270
262-
263-
264271
## Connection to the created Redis Failovers
265272
266273
In order to connect to the redis-failover and use it, a [Sentinel-ready](https://redis.io/topics/sentinel-clients) library has to be used. This will connect through the Sentinel service to the Redis node working as a master.
267274
The connection parameters are the following:
268275
269-
```
276+
```yaml
270277
url: rfs-<NAME>
271278
port: 26379
272279
master-name: mymaster
@@ -276,7 +283,7 @@ master-name: mymaster
276283
277284
To enable auth create a secret with a password field:
278285
279-
```
286+
```yaml
280287
echo -n "pass" > password
281288
kubectl create secret generic redis-auth --from-file=password
282289

@@ -293,19 +300,22 @@ spec:
293300
auth:
294301
secretPath: redis-auth
295302
```
303+
296304
You need to set secretPath as the secret name which is created before.
297305
298306
### Bootstrapping from pre-existing Redis Instance(s)
307+
299308
If you are wanting to migrate off of a pre-existing Redis instance, you can provide a `bootstrapNode` to your `RedisFailover` resource spec.
300309

301310
This `bootstrapNode` can be configured as follows:
302-
| Key | Type | Description | Example File |
303-
|:--------------:|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
304-
| 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) |
305-
| 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) |
311+
| Key | Type | Description | Example File |
312+
| :------------: | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
313+
| 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) |
314+
| 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) |
306315
| 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) |
307316

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

@@ -314,16 +324,19 @@ This allows for defining a `RedisFailover` that replicates from an existing Redi
314324
Depending on the configuration provided, the Operator will launch the `RedisFailover` in two bootstrapping states: without sentinels and with sentinels.
315325

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

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

324336
### Default versions
325337

326338
The image versions deployed by the operator can be found on the [defaults file](api/redisfailover/v1/defaults.go).
339+
327340
## Cleanup
328341

329342
### Operator and CRD
@@ -332,15 +345,15 @@ If you want to delete the operator from your Kubernetes cluster, the operator de
332345

333346
Also, the CRD has to be deleted. Deleting CRD automatically wil delete all redis failover custom resources and their managed resources:
334347

335-
```
348+
```sh
336349
kubectl delete crd redisfailovers.databases.spotahome.com
337350
```
338351

339352
### Single Redis Failover
340353

341354
Thanks to Kubernetes' `OwnerReference`, all the objects created from a redis-failover will be deleted after the custom resource is.
342355

343-
```
356+
```sh
344357
kubectl delete redisfailover <NAME>
345358
```
346359

@@ -349,6 +362,7 @@ kubectl delete redisfailover <NAME>
349362
### Redis Operator
350363

351364
[![Redis Operator Image](https://quay.io/repository/spotahome/redis-operator/status "Redis Operator Image")](https://quay.io/repository/spotahome/redis-operator)
365+
352366
## Documentation
353367

354368
For the code documentation, you can lookup on the [GoDoc](https://godoc.org/github.com/spotahome/redis-operator).

api/redisfailover/v1/types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ type RedisFailover struct {
2222

2323
// RedisFailoverSpec represents a Redis failover spec
2424
type RedisFailoverSpec struct {
25-
Redis RedisSettings `json:"redis,omitempty"`
26-
Sentinel SentinelSettings `json:"sentinel,omitempty"`
27-
Auth AuthSettings `json:"auth,omitempty"`
28-
LabelWhitelist []string `json:"labelWhitelist,omitempty"`
29-
BootstrapNode *BootstrapSettings `json:"bootstrapNode,omitempty"`
25+
Redis RedisSettings `json:"redis,omitempty"`
26+
Sentinel SentinelSettings `json:"sentinel,omitempty"`
27+
Auth AuthSettings `json:"auth,omitempty"`
28+
PropagateLabels []string `json:"propagateLabels,omitempty"`
29+
BootstrapNode *BootstrapSettings `json:"bootstrapNode,omitempty"`
3030
}
3131

3232
// RedisCommandRename defines the specification of a "rename-command" configuration option

api/redisfailover/v1/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)