From 7794e3ba2c989d8f7764e170c3656c8bcfd03669 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Mon, 12 Aug 2024 18:28:50 +0200 Subject: [PATCH] Add optionality. --- .../memgraph-high-availability/templates/coordinators.yaml | 4 ++++ charts/memgraph-high-availability/templates/data.yaml | 5 +++++ charts/memgraph-high-availability/values.yaml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index 1479492..74aeb00 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -14,6 +14,7 @@ spec: labels: app: memgraph-coordinator-{{ $coordinator.id }} spec: + {{ if $.Values.memgraph.affinity.enabled }} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -25,7 +26,10 @@ spec: - memgraph-coordinator-1 - memgraph-coordinator-2 - memgraph-coordinator-3 + - memgraph-data-0 + - memgraph-data-1 topologyKey: "kubernetes.io/hostname" + {{ end }} initContainers: - name: init image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index 3bfecd6..5d1758a 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -14,6 +14,7 @@ spec: labels: app: memgraph-data-{{ $data.id }} spec: + {{ if $.Values.memgraph.affinity.enabled }} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -22,9 +23,13 @@ spec: - key: app operator: In values: + - memgraph-coordinator-1 + - memgraph-coordinator-2 + - memgraph-coordinator-3 - memgraph-data-0 - memgraph-data-1 topologyKey: "kubernetes.io/hostname" + {{ end }} initContainers: - name: init image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index a6a756c..95c0322 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -36,6 +36,8 @@ memgraph: logPVCClassName: "" logPVC: true logPVCSize: "256Mi" + affinity: + enabled: false data: