Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ function check_creates_template() {
check_string_existence "--set modules.text2vec-aws.enabled=true --set modules.text2vec-aws.envSecrets.AWS_ACCESS_KEY_ID=key --set modules.text2vec-aws.envSecrets.AWS_SECRET_ACCESS_KEY=secret" "name: AWS_ACCESS_KEY_ID"
check_string_existence "--set modules.text2vec-aws.enabled=true --set modules.text2vec-aws.envSecrets.AWS_ACCESS_KEY_ID=key --set modules.text2vec-aws.envSecrets.AWS_SECRET_ACCESS_KEY=secret" "name: AWS_SECRET_ACCESS_KEY"

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"
check_setting_has_value "$_settingPassageQueryOn" "name: TRANSFORMERS_QUERY_INFERENCE_API" "value: http://transformers-inference-query.default.svc.cluster.local.:8080"
Expand Down
28 changes: 28 additions & 0 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,31 @@ Usage:
{{- printf "priorityClassName: %s" $priorityClassName -}}
{{- end -}}
{{- end -}}


{{/*
Raft cluster configuration settings
*/}}
{{- define "raft_configuration" -}}
{{- $replicas := .Values.replicas | int -}}
{{- $voters := .Values.env.RAFT_BOOTSTRAP_EXPECT | int -}}
{{- 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 -}}
2 changes: 2 additions & 0 deletions weaviate/templates/weaviateStatefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
app.kubernetes.io/managed-by: helm
spec:
replicas: {{ .Values.replicas }}
podManagementPolicy: {{ .Values.podManagementPolicy }}
updateStrategy:
{{ toYaml .Values.updateStrategy | indent 4}}
serviceName: {{ .Values.service.name }}-headless
Expand Down Expand Up @@ -98,6 +99,7 @@ spec:
- name: DEFAULT_VECTORIZER_MODULE
value: {{ index .Values "modules" "default_vectorizer_module" | trim }}
{{ template "enabled_modules" . }}
{{ template "raft_configuration" . }}
{{- if index .Values "modules" "text2vec-transformers" "enabled" }}
- name: TRANSFORMERS_INFERENCE_API
value: http://{{ index .Values "modules" "text2vec-transformers" "fullnameOverride" }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:8080
Expand Down
28 changes: 27 additions & 1 deletion weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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: 1.22.5
tag: 1.22.6
repo: semitechnologies/weaviate
# Image pull policy: https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -62,6 +62,11 @@ initContainers:
# to cases where no data is imported yet. Scaling down after importing data may
# break usability. Full dynamic scalability will be added in a future release.
replicas: 1

# Define how pods will be created. Possible values: OrderedReady | Parallel
# OrderedReady - pods will be created one after another
# Parallel - all pods will be created at once
podManagementPolicy: Parallel
updateStrategy:
type: RollingUpdate
resources: {}
Expand Down Expand Up @@ -223,6 +228,27 @@ 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
# RAFT_HEARTBEAT_TIMEOUT: 1
# RAFT_ELECTION_TIMEOUT: 1
# Control how often raft checks if it should perform a snapshot
# RAFT_SNAPSHOT_INTERVAL: 120
# Number of outstanding log entries before performing a snapshot
# RAFT_SNAPSHOT_THRESHOLD: 8192
Comment on lines +234 to +239

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Red, can you make appropriate comments on each env variable describing what it does and what's the default value?

We have a rule that we try to make descriptive comments on each env variable so that the user would know what a given setting does

# 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

Expand Down