diff --git a/.cicd/test.sh b/.cicd/test.sh index 9768879..729fe19 100755 --- a/.cicd/test.sh +++ b/.cicd/test.sh @@ -184,13 +184,44 @@ function check_creates_template() { check_string_existence "--set modules.text2vec-voyageai.enabled=true --set modules.text2vec-voyageai.apiKey=voyageaiApiKey --set modules.reranker-voyageai.enabled=true --set modules.reranker-voyageai.apiKey=voyageaiApiKey" "name: VOYAGEAI_APIKEY" check_setting_has_value "--set replicas=3 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=3 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" check_setting_has_value "--set replicas=8 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=8 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" check_setting_has_value "--set replicas=1 --set env.RAFT_BOOTSTRAP_EXPECT=1" "name: RAFT_JOIN" "value: \"weaviate-0\"" + check_setting_has_value "--set replicas=1 --set env.RAFT_BOOTSTRAP_EXPECT=1" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"1\"" check_setting_has_value "--set replicas=4 --set env.RAFT_BOOTSTRAP_EXPECT=4" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"4\"" check_setting_has_value "--set replicas=4 --set env.RAFT_BOOTSTRAP_EXPECT=4" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2,weaviate-3\"" check_setting_has_value "--set replicas=10 --set env.RAFT_BOOTSTRAP_EXPECT=4" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2,weaviate-3\"" check_setting_has_value "--set replicas=10 --set env.RAFT_JOIN=weaviate-100" "name: RAFT_JOIN" "value: \"weaviate-100\"" + check_setting_has_value "--set replicas=10 --set env.RAFT_JOIN=weaviate-100" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"1\"" check_setting_has_value "--set replicas=10 --set env.RAFT_JOIN=weaviate-100 --set env.RAFT_BOOTSTRAP_EXPECT=1" "name: RAFT_JOIN" "value: \"weaviate-100\"" + check_setting_has_value "--set replicas=100 --set env.RAFT_JOIN=weaviate-100\,weaviate-200" "name: RAFT_JOIN" "value: \"weaviate-100,weaviate-200\"" + check_setting_has_value "--set replicas=100 --set env.RAFT_JOIN=weaviate-100\,weaviate-200" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"2\"" + + check_setting_has_value "--set replicas=1" "name: RAFT_JOIN" "value: \"weaviate-0\"" + check_setting_has_value "--set replicas=1" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"1\"" + check_setting_has_value "--set replicas=2" "name: RAFT_JOIN" "value: \"weaviate-0\"" + check_setting_has_value "--set replicas=2" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"1\"" + check_setting_has_value "--set replicas=3" "name: RAFT_JOIN" "value: \"weaviate-0\"" + check_setting_has_value "--set replicas=3" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"1\"" + check_setting_has_value "--set replicas=4" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=4" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" + check_setting_has_value "--set replicas=5" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=5" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" + check_setting_has_value "--set replicas=6" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=6" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" + check_setting_has_value "--set replicas=7" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=7" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" + check_setting_has_value "--set replicas=8" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=8" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" + check_setting_has_value "--set replicas=9" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\"" + check_setting_has_value "--set replicas=9" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\"" + check_setting_has_value "--set replicas=10" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2,weaviate-3,weaviate-4\"" + check_setting_has_value "--set replicas=10" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"5\"" + check_setting_has_value "--set replicas=11" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2,weaviate-3,weaviate-4\"" + check_setting_has_value "--set replicas=11" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"5\"" + check_setting_has_value "--set replicas=100" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2,weaviate-3,weaviate-4\"" + check_setting_has_value "--set replicas=100" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"5\"" _settingPassageQueryOn="--set modules.text2vec-contextionary.enabled=false --set modules.text2vec-transformers.passageQueryServices.passage.enabled=true --set modules.text2vec-transformers.passageQueryServices.query.enabled=true" check_setting_has_value "$_settingPassageQueryOn" "name: TRANSFORMERS_PASSAGE_INFERENCE_API" "value: http://transformers-inference-passage.default.svc.cluster.local.:8080" diff --git a/weaviate/templates/_helpers.tpl b/weaviate/templates/_helpers.tpl index d4d337d..785b627 100644 --- a/weaviate/templates/_helpers.tpl +++ b/weaviate/templates/_helpers.tpl @@ -181,6 +181,15 @@ Raft cluster configuration settings {{- define "raft_configuration" -}} {{- $replicas := .Values.replicas | int -}} {{- $voters := .Values.env.RAFT_BOOTSTRAP_EXPECT | int -}} + {{- if empty .Values.env.RAFT_BOOTSTRAP_EXPECT -}} + {{- if ge $replicas 10 -}} + {{- $voters = 5 -}} + {{- else if ge $replicas 4 -}} + {{- $voters = 3 -}} + {{- else -}} + {{- $voters = 1 -}} + {{- end -}} + {{- end -}} {{- if gt $voters $replicas -}} {{- fail "env.RAFT_BOOTSTRAP_EXPECT value cannot be greater than replicas value" -}} {{- end -}} @@ -196,8 +205,15 @@ Raft cluster configuration settings value: "{{ join "," $nodes }}" {{- else -}} {{- $votersCount := len (split "," .Values.env.RAFT_JOIN) -}} + {{- if empty .Values.env.RAFT_BOOTSTRAP_EXPECT }} + {{- $voters = $votersCount -}} + {{- end -}} {{- if not (eq $votersCount $voters) -}} {{- fail "env.RAFT_BOOTSTRAP_EXPECT value needs to be equal to number of env.RAFT_JOIN nodes" -}} {{- end -}} {{- end -}} + {{- if empty .Values.env.RAFT_BOOTSTRAP_EXPECT }} + - name: RAFT_BOOTSTRAP_EXPECT + value: "{{ $voters }}" + {{- end -}} {{- end -}} diff --git a/weaviate/values.yaml b/weaviate/values.yaml index 0281eb8..17e804b 100644 --- a/weaviate/values.yaml +++ b/weaviate/values.yaml @@ -259,11 +259,12 @@ env: CLUSTER_GOSSIP_BIND_PORT: 7000 CLUSTER_DATA_BIND_PORT: 7001 - # Set RAFT cluster expected number of voter nodes at bootstrap - RAFT_BOOTSTRAP_EXPECT: 1 + # Set RAFT cluster expected number of voter nodes at bootstrap. + # By default helm automatically sets this value based on the cluster size. + # RAFT_BOOTSTRAP_EXPECT: 1 - # Set RAFT cluster bootstrap timeout (in seconds), default is 10 (seconds) - # RAFT_BOOTSTRAP_TIMEOUT: 10 + # Set RAFT cluster bootstrap timeout (in seconds), default is 90 (seconds) + # RAFT_BOOTSTRAP_TIMEOUT: 90 # Set manually RAFT voter nodes. # RAFT_JOIN value is automatically generated by "raft_configuration"