Skip to content

Commit

Permalink
Merge pull request #116 from wowsel/add-tolerations-support
Browse files Browse the repository at this point in the history
Tolerations support added
  • Loading branch information
jchanam authored Feb 26, 2019
2 parents 5be1137 + d62cd36 commit e9036c4
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 15 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,43 @@ In order to have persistence, a `PersistentVolumeClaim` usage is allowed. The fu

**IMPORTANT**: By default, the persistent volume claims will be deleted when the Redis Failover is. If this is not the expected usage, a `keepAfterDeletion` flag can be added under the `storage` section of Redis. [An example is given](example/redisfailover/persistent-storage-no-pvc-deletion.yaml).

### NodeAffinity and Tolerations
You can use NodeAffinity and Tolerations to deploy Pods to isolated groups of Nodes

Example:
```yaml
apiVersion: v1
items:
- apiVersion: storage.spotahome.com/v1alpha2
kind: RedisFailover
metadata:
name: redis
spec:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kops.k8s.io/instancegroup
operator: In
values:
- productionnodes
hardAntiAffinity: false
redis: null
sentinel:
replicas: 3
resources:
limits:
memory: 100Mi
requests:
cpu: 100m
tolerations:
- effect: NoExecute
key: dedicated
operator: Equal
value: production
kind: List
```
### Custom configurations
It is possible to configure both Redis and Sentinel. This is done with the `customConfig` option inside their spec. It is a list of configurations and their values.
Expand Down
3 changes: 3 additions & 0 deletions api/redisfailover/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ type RedisFailoverSpec struct {
// NodeAffinity defines the rules for scheduling the Redis and Sentinel
// nodes
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty"`

//Tolerations provides a way to schedule Pods on Tainted Nodes
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

// RedisSettings defines the specification of the redis cluster
Expand Down
9 changes: 8 additions & 1 deletion api/redisfailover/v1alpha2/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/clientset.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/doc.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/fake/clientset_generated.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/fake/doc.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/fake/register.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/scheme/doc.go

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

2 changes: 1 addition & 1 deletion client/k8s/clientset/versioned/scheme/register.go

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

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

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

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

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

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

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

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

2 changes: 2 additions & 0 deletions operator/redisfailover/service/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ func generateRedisStatefulSet(rf *redisfailoverv1alpha2.RedisFailover, labels ma
NodeAffinity: rf.Spec.NodeAffinity,
PodAntiAffinity: createPodAntiAffinity(rf.Spec.HardAntiAffinity, labels),
},
Tolerations: rf.Spec.Tolerations,
Containers: []corev1.Container{
{
Name: "redis",
Expand Down Expand Up @@ -297,6 +298,7 @@ func generateSentinelDeployment(rf *redisfailoverv1alpha2.RedisFailover, labels
NodeAffinity: rf.Spec.NodeAffinity,
PodAntiAffinity: createPodAntiAffinity(rf.Spec.HardAntiAffinity, labels),
},
Tolerations: rf.Spec.Tolerations,
InitContainers: []corev1.Container{
{
Name: "sentinel-config-copy",
Expand Down

0 comments on commit e9036c4

Please sign in to comment.