Skip to content

Commit

Permalink
Adjust RAFT settings generation
Browse files Browse the repository at this point in the history
  • Loading branch information
antas-marcin committed Apr 19, 2024
1 parent 9f41612 commit af29141
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
11 changes: 8 additions & 3 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,14 @@ function check_creates_template() {
check_string_existence "--set modules.reranker-voyageai.enabled=true --set modules.reranker-voyageai.apiKey=voyageaiApiKey" "name: VOYAGEAI_APIKEY"
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" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\""
check_setting_has_value "--set replicas=1" "name: RAFT_JOIN" "value: \"weaviate-0\""
check_setting_has_value "--set replicas=4" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"4\""
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=8 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\""
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=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 --set env.RAFT_BOOTSTRAP_EXPECT=1" "name: RAFT_JOIN" "value: \"weaviate-100\""

_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"
Expand Down
25 changes: 18 additions & 7 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,25 @@ Usage:
Raft cluster configuration settings
*/}}
{{- define "raft_configuration" -}}
{{- $replicas := .Values.replicas | int -}}
{{- $voters := .Values.env.RAFT_BOOTSTRAP_EXPECT | int -}}
{{- $nodes := list -}}
{{- range $i := until $voters -}}
{{- $node_name := list -}}
{{- $node_name = append $node_name "weaviate" -}}
{{- $node_name = append $node_name $i -}}
{{- $nodes = append $nodes (join "-" $node_name) -}}
{{- end }}
{{- if gt $voters $replicas -}}
{{- fail "env.RAFT_BOOTSTRAP_EXPECT value cannot be greater than replicas value" -}}
{{- end -}}
{{- if empty .Values.env.RAFT_JOIN -}}
{{- $nodes := list -}}
{{- range $i := until $voters -}}
{{- $node_name := list -}}
{{- $node_name = append $node_name "weaviate" -}}
{{- $node_name = append $node_name $i -}}
{{- $nodes = append $nodes (join "-" $node_name) -}}
{{- end -}}
- name: RAFT_JOIN
value: "{{ join "," $nodes }}"
{{- else -}}
{{- $votersCount := len (split "," .Values.env.RAFT_JOIN) -}}
{{- if not (eq $votersCount $voters) -}}
{{- fail "env.RAFT_BOOTSTRAP_EXPECT value needs to be equal to number of env.RAFT_JOIN nodes" -}}
{{- end -}}
{{- end -}}
{{- end -}}
22 changes: 16 additions & 6 deletions weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,29 @@ debug: false
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 bootstrap timeout (in seconds), default is 10 (seconds)
# RAFT_BOOTSTRAP_TIMEOUT: 10

# Set manually RAFT voter nodes.
# RAFT_JOIN value is automatically generated by "raft_configuration"
# template, but if someone wants to set this value manually then it can be done
# by setting RAFT_JOIN environment variable, example: RAFT_JOIN: "weaviate-0,weaviate-1"
# Please notice that in this case RAFT_BOOTSTRAP_EXPECT setting needs to be also adjusted manually
# to match the number of RAFT voters, so if there are 2 nodes set using RAFT_JOIN variable
# then RAFT_BOOTSTRAP_EXPECT needs to be equal 2 also.
# RAFT_JOIN: "weaviate-0"

# The aggressiveness of the Go Garbage Collector. 100 is the default value.
GOGC: 100

# Expose metrics on port 2112 for Prometheus to scrape
PROMETHEUS_MONITORING_ENABLED: false
PROMETHEUS_MONITORING_GROUP: false

# Raft settings are generated automatically by "raft_configuration" template
# Set Raft cluster bootstrap timeout (in seconds), default is 10 (seconds)
RAFT_BOOTSTRAP_TIMEOUT: 30
RAFT_BOOTSTRAP_EXPECT: 1


# Set a MEM limit for the Weaviate Pod so it can help you both increase GC-related
# performance as well as avoid GC-related out-of-memory (“OOM”) situations
# GOMEMLIMIT: 6GiB
Expand Down

0 comments on commit af29141

Please sign in to comment.