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 authored and jfrancoa committed Mar 21, 2024
1 parent 94811e9 commit f8a8526
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
11 changes: 8 additions & 3 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,14 @@ function check_creates_template() {
check_string_existence "--set modules.generative-mistral.enabled=true --set modules.generative-mistral.apiKey=apiKey" "name: MISTRAL_APIKEY"
check_string_existence "--set modules.multi2vec-palm.enabled=true --set modules.multi2vec-palm.apiKey=palmApiKey" "name: PALM_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 @@ -176,14 +176,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 -}}
26 changes: 18 additions & 8 deletions weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ image:
# of weaviate. In accordance with Infra-as-code, you should pin this value
# down and only change it if you explicitly want to upgrade the Weaviate
# version.
tag: latest
repo: library/module_test_image_raft
tag: 1.24.4
repo: semitechnologies/weaviate
# Image pull policy: https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
pullPolicy: IfNotPresent
pullSecrets: []
Expand Down Expand Up @@ -231,19 +231,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 f8a8526

Please sign in to comment.