Skip to content

Commit

Permalink
feat(query): allow enable load blance queries (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaneur2020 authored Aug 6, 2024
1 parent 6a55ee6 commit 2224f83
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions charts/databend-query/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if .Values.enableLoadBalance }}
{{- $_ := set .Values.ingress.annotations "nginx.ingress.kubernetes.io/upstream-hash-by" "$http_x_databend_route_hint" }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/databend-query/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- end }}
selector:
{{- include "databend-query.selectorLabels" . | nindent 4 }}
{{- if eq (lower .Values.workload) "statefulset" }}
{{- if and (eq .Values.workload "statefulset") (not .Values.enableLoadBalance) }}
statefulset.kubernetes.io/pod-name: {{ include "databend-query.fullname" . }}-0
{{- end }}
{{- with .Values.service.sessionAffinity }}
Expand Down
4 changes: 4 additions & 0 deletions charts/databend-query/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ replicaCount: 1
# Could be StatefulSet or Deployment
workload: StatefulSet

# By default, the queries are routed to the first node in the StatefulSet, and this node is considered
# as the coordinator. If you want to enable load balance queries across nodes, set this to true.
enableLoadBalance: false

image:
repository: datafuselabs/databend-query
pullPolicy: IfNotPresent
Expand Down

0 comments on commit 2224f83

Please sign in to comment.