Skip to content
Snippets Groups Projects
Commit 432f1748 authored by Samuel Vijaykumar M's avatar Samuel Vijaykumar M
Browse files

Add extravolumes and extravolumemounts

parent d92dfef4
No related branches found
No related tags found
No related merge requests found
...@@ -163,6 +163,37 @@ app.kubernetes.io/part-of ...@@ -163,6 +163,37 @@ app.kubernetes.io/part-of
redisfailovers.databases.spotahome.com/name redisfailovers.databases.spotahome.com/name
``` ```
### ExtraVolumes and ExtraVolumeMounts
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
- Secrets that sidecars might use to backup of RDBs
- Extra users and their secrets and acls that could used the initContainers to create multiple users
- Extra Configurations that could merge on top the existing configurations
```
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
name: redisfailover
spec:
sentinel:
replicas: 3
redis:
replicas: 3
extraVolumes:
- name: foo_user
secret:
secretName: mysecret
optional: false
exraVolumeMounts:
- name: foo
mountPath: "/etc/foo"
readOnly: true
```
## Connection to the created Redis Failovers ## Connection to the created Redis Failovers
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. 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.
......
...@@ -64,6 +64,8 @@ type RedisSettings struct { ...@@ -64,6 +64,8 @@ type RedisSettings struct {
PriorityClassName string `json:"priorityClassName,omitempty"` PriorityClassName string `json:"priorityClassName,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"` ServiceAccountName string `json:"serviceAccountName,omitempty"`
TerminationGracePeriodSeconds int64 `json:"terminationGracePeriod,omitempty"` TerminationGracePeriodSeconds int64 `json:"terminationGracePeriod,omitempty"`
ExtraVolumes []corev1.Volume `json:"extraVolumes,omitempty"`
ExtraVolumeMounts []corev1.VolumeMount `json:"extraVolumeMounts,omitempty"`
} }
// SentinelSettings defines the specification of the sentinel cluster // SentinelSettings defines the specification of the sentinel cluster
......
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
name: redisfailover
spec:
sentinel:
replicas: 3
redis:
replicas: 3
extraVolumes:
- name: foo_user
secret:
secretName: mysecret
optional: false
exraVolumeMounts:
- name: foo
mountPath: "/etc/foo"
readOnly: true
\ No newline at end of file
...@@ -781,6 +781,10 @@ func getRedisVolumeMounts(rf *redisfailoverv1.RedisFailover) []corev1.VolumeMoun ...@@ -781,6 +781,10 @@ func getRedisVolumeMounts(rf *redisfailoverv1.RedisFailover) []corev1.VolumeMoun
}, },
} }
if rf.Spec.Redis.ExtraVolumeMounts != nil {
volumeMounts = append(volumeMounts, rf.Spec.Redis.ExtraVolumeMounts...)
}
return volumeMounts return volumeMounts
} }
...@@ -830,6 +834,10 @@ func getRedisVolumes(rf *redisfailoverv1.RedisFailover) []corev1.Volume { ...@@ -830,6 +834,10 @@ func getRedisVolumes(rf *redisfailoverv1.RedisFailover) []corev1.Volume {
volumes = append(volumes, *dataVolume) volumes = append(volumes, *dataVolume)
} }
if rf.Spec.Redis.ExtraVolumes != nil {
volumes = append(volumes, rf.Spec.Redis.ExtraVolumes...)
}
return volumes return volumes
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment