From bd0464647c027aaa0873f2e5393930fc8ed68522 Mon Sep 17 00:00:00 2001 From: Sergey Nazarov Date: Mon, 24 Sep 2018 10:38:08 -0700 Subject: [PATCH] Add configurable affinity to CouchDB StatefulSet (#7224) Signed-off-by: Sergey Nazarov --- incubator/couchdb/Chart.yaml | 2 +- incubator/couchdb/README.md | 1 + incubator/couchdb/templates/statefulset.yaml | 4 ++++ incubator/couchdb/values.yaml | 13 +++++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/incubator/couchdb/Chart.yaml b/incubator/couchdb/Chart.yaml index c0b0670763..37450cecbc 100644 --- a/incubator/couchdb/Chart.yaml +++ b/incubator/couchdb/Chart.yaml @@ -1,5 +1,5 @@ name: couchdb -version: 0.2.0 +version: 0.2.1 appVersion: 2.2.0 description: A database featuring seamless multi-master sync, that scales from big data to mobile, with an intuitive HTTP/JSON API and designed for diff --git a/incubator/couchdb/README.md b/incubator/couchdb/README.md index 55076deac9..846e738ede 100644 --- a/incubator/couchdb/README.md +++ b/incubator/couchdb/README.md @@ -103,6 +103,7 @@ A variety of other parameters are also configurable. See the comments in the | `persistentVolume.accessModes` | ReadWriteOnce | | `persistentVolume.storageClass` | Default for the Kube cluster | | `podManagementPolicy` | Parallel | +| `affinity` | | | `resources` | | | `service.enabled` | true | | `service.type` | ClusterIP | diff --git a/incubator/couchdb/templates/statefulset.yaml b/incubator/couchdb/templates/statefulset.yaml index 34dea7d31a..204ff75f52 100644 --- a/incubator/couchdb/templates/statefulset.yaml +++ b/incubator/couchdb/templates/statefulset.yaml @@ -94,6 +94,10 @@ spec: {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} +{{- end }} +{{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} {{- end }} volumes: - name: config-storage diff --git a/incubator/couchdb/values.yaml b/incubator/couchdb/values.yaml index 7ee33f0fd0..f486cb3121 100644 --- a/incubator/couchdb/values.yaml +++ b/incubator/couchdb/values.yaml @@ -54,6 +54,19 @@ helperImage: ## `OrderedReady` podManagementPolicy: Parallel +## To better tolerate Node failures, we can prevent Kubernetes scheduler from +## assigning more than one Pod of CouchDB StatefulSet per Node using podAntiAffinity. +affinity: + # podAntiAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # - labelSelector: + # matchExpressions: + # - key: "app" + # operator: In + # values: + # - couchdb + # topologyKey: "kubernetes.io/hostname" + ## A StatefulSet requires a headless Service to establish the stable network ## identities of the Pods, and that Service is created automatically by this ## chart without any additional configuration. The Service block below refers