diff --git a/CHANGELOG.md b/CHANGELOG.md index 892cdbd9..a5f6aba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # GraphDB Helm chart release notes +## Version 11.1.0 + +### New + +- Added `podAntiAffinity` and `proxy.podAntiAffinity` for configuring a default podAntiAffinity for the GraphDB pods and + GraphDB proxy pods. The default values configure a "soft" podAntiAffinity that tries to schedule GraphDB pods across + different Kubernetes hosts but does not enforce it. + ## Version 11.0.1 GraphDB Helm 11.0.1 is a patch release that includes bug fixes. diff --git a/README.md b/README.md index 4ffe9a99..9b16388f 100644 --- a/README.md +++ b/README.md @@ -434,6 +434,9 @@ IMPORTANT: This is generated by helm-docs, do not attempt modifying it on hand a | persistence.volumeClaimTemplate.spec.accessModes[0] | string | `"ReadWriteOnce"` | | | persistence.volumeClaimTemplate.spec.resources.requests.storage | string | `"5Gi"` | | | podAnnotations | object | `{}` | | +| podAntiAffinity.enabled | bool | `true` | | +| podAntiAffinity.preset | string | `"soft"` | | +| podAntiAffinity.topology | string | `"kubernetes.io/hostname"` | | | podDisruptionBudget.enabled | bool | `true` | | | podDisruptionBudget.maxUnavailable | string | `""` | | | podDisruptionBudget.minAvailable | string | `"51%"` | | @@ -506,6 +509,9 @@ IMPORTANT: This is generated by helm-docs, do not attempt modifying it on hand a | proxy.persistence.volumeClaimTemplate.spec.accessModes[0] | string | `"ReadWriteOnce"` | | | proxy.persistence.volumeClaimTemplate.spec.resources.requests.storage | string | `"500Mi"` | | | proxy.podAnnotations | object | `{}` | | +| proxy.podAntiAffinity.enabled | bool | `true` | | +| proxy.podAntiAffinity.preset | string | `"soft"` | | +| proxy.podAntiAffinity.topology | string | `"kubernetes.io/hostname"` | | | proxy.podDisruptionBudget.enabled | bool | `true` | | | proxy.podDisruptionBudget.maxUnavailable | string | `""` | | | proxy.podDisruptionBudget.minAvailable | string | `"51%"` | | diff --git a/templates/graphdb/statefulset.yaml b/templates/graphdb/statefulset.yaml index 013b9e56..a63a8002 100644 --- a/templates/graphdb/statefulset.yaml +++ b/templates/graphdb/statefulset.yaml @@ -129,8 +129,31 @@ spec: {{- with .Values.nodeSelector }} nodeSelector: {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} - {{- with .Values.affinity }} - affinity: {{- tpl (toYaml .) $ | nindent 8 }} + {{- if or .Values.affinity .Values.podAntiAffinity.enabled }} + affinity: + {{- if .Values.affinity }} + {{- tpl (toYaml .Values.affinity) $ | nindent 8 }} + {{- end }} + {{- if and .Values.podAntiAffinity.enabled (not .Values.affinity.podAntiAffinity) }} + podAntiAffinity: + {{- if eq .Values.podAntiAffinity.preset "soft" }} + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: {{ .Values.podAntiAffinity.topology }} + labelSelector: + matchLabels: + {{- include "graphdb.selectorLabels" . | nindent 20 }} + {{- else if eq .Values.podAntiAffinity.preset "hard" }} + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: {{ .Values.podAntiAffinity.topology }} + labelSelector: + matchLabels: + {{- include "graphdb.selectorLabels" . | nindent 18 }} + {{- else }} + {{- fail (printf "Unknown podAntiAffinity preset '%s'" .Values.podAntiAffinity.preset) }} + {{- end }} + {{- end }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- tpl (toYaml .) $ | nindent 8 }} diff --git a/templates/proxy/statefulset.yaml b/templates/proxy/statefulset.yaml index 6547a319..5443d9bb 100644 --- a/templates/proxy/statefulset.yaml +++ b/templates/proxy/statefulset.yaml @@ -98,8 +98,31 @@ spec: {{- with .Values.proxy.nodeSelector }} nodeSelector: {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} - {{- with .Values.proxy.affinity }} - affinity: {{- tpl (toYaml .) $ | nindent 8 }} + {{- if or .Values.proxy.affinity .Values.proxy.podAntiAffinity.enabled }} + affinity: + {{- if .Values.proxy.affinity }} + {{- tpl (toYaml .Values.proxy.affinity) $ | nindent 8 }} + {{- end }} + {{- if and .Values.proxy.podAntiAffinity.enabled (not .Values.proxy.affinity.podAntiAffinity) }} + podAntiAffinity: + {{- if eq .Values.proxy.podAntiAffinity.preset "soft" }} + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + podAffinityTerm: + topologyKey: {{ .Values.proxy.podAntiAffinity.topology }} + labelSelector: + matchLabels: + {{- include "graphdb-proxy.selectorLabels" . | nindent 20 }} + {{- else if eq .Values.proxy.podAntiAffinity.preset "hard" }} + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: {{ .Values.proxy.podAntiAffinity.topology }} + labelSelector: + matchLabels: + {{- include "graphdb-proxy.selectorLabels" . | nindent 18 }} + {{- else }} + {{- fail (printf "Unknown podAntiAffinity preset '%s'" .Values.proxy.podAntiAffinity.preset) }} + {{- end }} + {{- end }} {{- end }} {{- with .Values.proxy.tolerations }} tolerations: {{- tpl (toYaml .) $ | nindent 8 }} diff --git a/values.yaml b/values.yaml index f6bb71da..f4e32e87 100644 --- a/values.yaml +++ b/values.yaml @@ -648,6 +648,18 @@ nodeSelector: {} # Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity affinity: {} +# Default podAntiAffinity rule ensuring that GraphDB pods are scheduled on different Kubernetes nodes. +# Note that this would take effect when GraphDB is deployed in a cluster. +# +# Possible values for .Values.podAntiAffinity.preset are: +# - "soft" (default) - Configures a preferredDuringSchedulingIgnoredDuringExecution rule. +# - "hard" - Configures a requiredDuringSchedulingIgnoredDuringExecution rule. +# Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity +podAntiAffinity: + enabled: true + preset: soft + topology: kubernetes.io/hostname + # List of taint tolerations. # Values are processed as Helm templates. # Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ @@ -1192,6 +1204,18 @@ proxy: # Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity affinity: {} + # Default podAntiAffinity rule ensuring that GraphDB pods are scheduled on different Kubernetes nodes. + # Note that this would take effect when GraphDB is deployed in a cluster. + # + # Possible values for .Values.podAntiAffinity.preset are: + # - "soft" (default) - Configures a preferredDuringSchedulingIgnoredDuringExecution rule. + # - "hard" - Configures a requiredDuringSchedulingIgnoredDuringExecution rule. + # Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity + podAntiAffinity: + enabled: true + preset: soft + topology: kubernetes.io/hostname + # List of taint tolerations. # Values are processed as Helm templates. # Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/