Skip to content

Commit

Permalink
Merge pull request #108 from Ontotext-AD/GDB-10410-default-anti-affinity
Browse files Browse the repository at this point in the history
GDB-10410: Added default podAntiAffinity configurations
  • Loading branch information
mihailradkov authored Jul 5, 2024
2 parents 964dd27 + 483ca6c commit 546e624
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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%"` | |
Expand Down Expand Up @@ -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%"` | |
Expand Down
27 changes: 25 additions & 2 deletions templates/graphdb/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
27 changes: 25 additions & 2 deletions templates/proxy/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
24 changes: 24 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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/
Expand Down

0 comments on commit 546e624

Please sign in to comment.