From c4e966018f3d94743729424c35ac1814a5e77de7 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Vrielynck <43749206+pvriel@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:42:02 +0100 Subject: [PATCH] [NYS2AWS-71] allow node anti-affinity for Solr pods --- CHANGELOG.md | 3 +++ README.md | 8 ++++++++ xenit-alfresco/templates/solr/solr-stateful-set.yaml | 12 ++++++++++++ xenit-alfresco/values.yaml | 1 + 4 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c5798..77c9c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ chronology things are added/fixed/changed and - where possible - links to the PR ### Changes +[v0.8.2] +* added solr.enforceHostnameAntiAffinity + [v0.8.0] * **Potentially breaking change**: changed `alfresco-ingress` definition & default values to enable usage of `ingressClassName` property in favour of `kubernetes.io/ingress.class` annotation. diff --git a/README.md b/README.md index 20ec6b4..cc915ca 100644 --- a/README.md +++ b/README.md @@ -1330,6 +1330,14 @@ nginx rules to redirect the normal pages to a 503 maintenance page. ``` * Description: With this list of parameters you can add 1 or multiple annotations to the Solr service +#### `solr.enforceHostnameAntiAffinity` + +* Required: false +* Default: false +* Description: If true, this option enforces a pod anti-affinity on the Solr pods based on the hostnames. + I.e. if true, each Solr pod will require a unique node. Starting more pods than nodes will put the + remainder pods in a `Pending` state. + #### `solr.serviceAccount` * Required: false diff --git a/xenit-alfresco/templates/solr/solr-stateful-set.yaml b/xenit-alfresco/templates/solr/solr-stateful-set.yaml index bdfe112..9192de0 100644 --- a/xenit-alfresco/templates/solr/solr-stateful-set.yaml +++ b/xenit-alfresco/templates/solr/solr-stateful-set.yaml @@ -30,6 +30,18 @@ spec: {{ toYaml .Values.solr.podAnnotations | nindent 8 }} {{- end }} spec: + {{- if .Values.solr.enforceHostnameAntiAffinity }} + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - topologyKey: "kubernetes.io/hostname" + labelSelector: + matchExpressions: + - key: "app" + operator: "In" + values: + - solr + {{- end }} {{- if .Values.solr.serviceAccount }} serviceAccountName: {{ .Values.solr.serviceAccount }} {{- end }} diff --git a/xenit-alfresco/values.yaml b/xenit-alfresco/values.yaml index 23e75b9..b1b54b0 100644 --- a/xenit-alfresco/values.yaml +++ b/xenit-alfresco/values.yaml @@ -151,6 +151,7 @@ postgresql: solr: enabled: true replicas: 2 + enforceHostnameAntiAffinity: false podManagementPolicy: Parallel image: registry: 'docker.io'