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 1/3] [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' From d84a70d365851cc4a508bafbd4bc0465a31026fa Mon Sep 17 00:00:00 2001 From: Pieter-Jan Vrielynck <43749206+pvriel@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:51:02 +0100 Subject: [PATCH 2/3] [NYS2AWS-71] replace hostname with zone affinity --- CHANGELOG.md | 2 +- README.md | 6 +++--- xenit-alfresco/templates/solr/solr-stateful-set.yaml | 4 ++-- xenit-alfresco/values.yaml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c9c76..6fdce45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ chronology things are added/fixed/changed and - where possible - links to the PR ### Changes [v0.8.2] -* added solr.enforceHostnameAntiAffinity +* added solr.enforceZoneAntiAffinity [v0.8.0] diff --git a/README.md b/README.md index cc915ca..ba77044 100644 --- a/README.md +++ b/README.md @@ -1330,12 +1330,12 @@ 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` +#### `solr.enforceZoneAntiAffinity` * 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 +* Description: If true, this option enforces a pod anti-affinity on the Solr pods based on the zones. + I.e. if true, each Solr pod will require a unique zone. Starting more pods than zones will put the remainder pods in a `Pending` state. #### `solr.serviceAccount` diff --git a/xenit-alfresco/templates/solr/solr-stateful-set.yaml b/xenit-alfresco/templates/solr/solr-stateful-set.yaml index 9192de0..8041901 100644 --- a/xenit-alfresco/templates/solr/solr-stateful-set.yaml +++ b/xenit-alfresco/templates/solr/solr-stateful-set.yaml @@ -30,11 +30,11 @@ spec: {{ toYaml .Values.solr.podAnnotations | nindent 8 }} {{- end }} spec: - {{- if .Values.solr.enforceHostnameAntiAffinity }} + {{- if .Values.solr.enforceZoneAntiAffinity }} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - - topologyKey: "kubernetes.io/hostname" + - topologyKey: "topology.kubernetes.io/zone" labelSelector: matchExpressions: - key: "app" diff --git a/xenit-alfresco/values.yaml b/xenit-alfresco/values.yaml index b1b54b0..6372d89 100644 --- a/xenit-alfresco/values.yaml +++ b/xenit-alfresco/values.yaml @@ -151,7 +151,7 @@ postgresql: solr: enabled: true replicas: 2 - enforceHostnameAntiAffinity: false + enforceZoneAntiAffinity: false podManagementPolicy: Parallel image: registry: 'docker.io' From e8d56c1c0af304df27e76040f2f9815bf44527dd Mon Sep 17 00:00:00 2001 From: Pieter-Jan Vrielynck <43749206+pvriel@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:44:32 +0100 Subject: [PATCH 3/3] [NYS2AWS-71] update README with info from testing results --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ba77044..8fec72b 100644 --- a/README.md +++ b/README.md @@ -1337,6 +1337,8 @@ nginx rules to redirect the normal pages to a 503 maintenance page. * Description: If true, this option enforces a pod anti-affinity on the Solr pods based on the zones. I.e. if true, each Solr pod will require a unique zone. Starting more pods than zones will put the remainder pods in a `Pending` state. +
+ Please note that switching off the anti-affinity does not alter the anti-affinity of the already running pods! #### `solr.serviceAccount`