Skip to content

Commit

Permalink
Add experimental feature: streaming node (#120)
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Zeng <[email protected]>
  • Loading branch information
LoveEachDay authored Aug 22, 2024
1 parent d55bb75 commit 8ff49be
Show file tree
Hide file tree
Showing 15 changed files with 267 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/milvus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: milvus
appVersion: "2.4.9"
kubeVersion: "^1.10.0-0"
description: Milvus is an open-source vector database built to power AI applications and vector similarity search.
version: 4.2.7
version: 4.2.8
keywords:
- milvus
- elastic
Expand Down
8 changes: 8 additions & 0 deletions charts/milvus/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{ template "milvus.fullname" . }}-mixcoord
{{- end -}}

{{/*
Create a default fully qualified Streaming Node name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "milvus.streamingnode.fullname" -}}
{{ template "milvus.fullname" . }}-streamingnode
{{- end -}}

{{/*
Create a default fully qualified pulsar name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/datacoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
args: [ "milvus", "run", "datacoord" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.dataCoordinator.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/datanode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ spec:
args: [ "milvus", "run", "datanode" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.dataNode.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/indexcoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
args: [ "milvus", "run", "indexcoord" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.indexCoordinator.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/indexnode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ spec:
args: [ "milvus", "run", "indexnode" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.indexNode.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/mixcoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
args: [ "milvus", "run", "mixture", "-rootcoord", "-querycoord", "-datacoord", "-indexcoord" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.mixCoordinator.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ spec:
args: [ "milvus", "run", "proxy" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.proxy.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/querycoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
args: [ "milvus", "run", "querycoord" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.queryCoordinator.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/querynode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ spec:
args: [ "milvus", "run", "querynode" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.queryNode.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/rootcoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
args: [ "milvus", "run", "rootcoord" ]
{{- end }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.rootCoordinator.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
4 changes: 4 additions & 0 deletions charts/milvus/templates/standalone-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ spec:
resources:
{{- toYaml .Values.standalone.resources | nindent 10 }}
env:
{{- if .Values.streaming.enabled }}
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- end }}
{{- if .Values.standalone.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
Expand Down
175 changes: 175 additions & 0 deletions charts/milvus/templates/streamingnode-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{{- if and .Values.streaming.enabled .Values.cluster.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "milvus.streamingnode.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "milvus.labels" . | indent 4 }}
component: "streamingnode"

{{ include "milvus.ud.labels" . | indent 4 }}
annotations:
{{ include "milvus.ud.annotations" . | indent 4 }}

spec:
{{- if ge (int .Values.streamingNode.replicas) 0 }}
replicas: {{ .Values.streamingNode.replicas }}
{{- end }}
{{- with .Values.streamingNode.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{ include "milvus.matchLabels" . | indent 6 }}
component: "streamingnode"
template:
metadata:
labels:
{{ include "milvus.matchLabels" . | indent 8 }}
component: "streamingnode"
{{ include "milvus.ud.labels" . | indent 8 }}
annotations:
{{- if .Values.streamingNode.profiling.enabled }}
pyroscope.io/scrape: "true"
pyroscope.io/application-name: {{ template "milvus.streamingnode.fullname" . }}
pyroscope.io/port: "9091"
{{- end }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{ include "milvus.ud.annotations" . | indent 8 }}
spec:
serviceAccountName: {{ include "milvus.serviceAccount" . }}
{{- if .Values.image.all.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.all.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
initContainers:
{{- if .Values.streamingNode.heaptrack.enabled }}
- name: heaptrack
command:
- /bin/bash
- -c
- "cp -r /opt/heaptrack /milvus/tools"
image: "{{ .Values.heaptrack.image.repository }}:{{ .Values.heaptrack.image.tag }}"
imagePullPolicy: {{ .Values.heaptrack.image.pullPolicy }}
volumeMounts:
- mountPath: /milvus/tools
name: tools
{{- end }}
containers:
- name: streamingnode
image: "{{ .Values.image.all.repository }}:{{ .Values.image.all.tag }}"
imagePullPolicy: {{ .Values.image.all.pullPolicy }}
{{- if .Values.streamingNode.heaptrack.enabled }}
args: [ "/milvus/tools/heaptrack/bin/heaptrack", "milvus", "run", "streamingnode" ]
{{- else }}
args: [ "milvus", "run", "streamingnode" ]
{{- end }}
env:
- name: MILVUS_STREAMING_SERVICE_ENABLED
value: "1"
{{- if .Values.streamingNode.heaptrack.enabled }}
- name: LD_LIBRARY_PATH
value: /milvus/tools/heaptrack/lib:/milvus/lib:/usr/lib
{{- end }}
{{- if .Values.streamingNode.extraEnv }}
{{- toYaml .Values.streamingNode.extraEnv | nindent 8 }}
{{- end }}
ports:
- name: streamingnode
containerPort: 22222
protocol: TCP
- name: metrics
containerPort: 9091
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: metrics
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: metrics
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
{{- end }}
resources:
{{- toYaml .Values.streamingNode.resources | nindent 10 }}
volumeMounts:
{{- if .Values.customConfigMap }}
- name: milvus-config
mountPath: /milvus/configs/user.yaml
subPath: milvus.yaml
readOnly: true
{{- else }}
- name: milvus-config
mountPath: /milvus/configs/default.yaml
subPath: default.yaml
readOnly: true
- name: milvus-config
mountPath: /milvus/configs/user.yaml
subPath: user.yaml
readOnly: true
{{- end }}
{{- if .Values.log.persistence.enabled }}
- name: milvus-logs-disk
mountPath: {{ .Values.log.persistence.mountPath | quote }}
subPath: {{ .Values.log.persistence.persistentVolumeClaim.subPath | default "" }}
{{- end }}
- mountPath: /milvus/tools
name: tools

{{- if and (.Values.nodeSelector) (not .Values.streamingNode.nodeSelector) }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.streamingNode.nodeSelector }}
nodeSelector:
{{ toYaml .Values.streamingNode.nodeSelector | indent 8 }}
{{- end }}
{{- if and (.Values.affinity) (not .Values.streamingNode.affinity) }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- if .Values.streamingNode.affinity }}
affinity:
{{ toYaml .Values.streamingNode.affinity | indent 8 }}
{{- end }}
{{- if and (.Values.tolerations) (not .Values.streamingNode.tolerations) }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.streamingNode.tolerations }}
tolerations:
{{ toYaml .Values.streamingNode.tolerations | indent 8 }}
{{- end }}
volumes:
- name: milvus-config
configMap:
{{- if .Values.customConfigMap }}
name: {{ .Values.customConfigMap }}
{{- else }}
name: {{ template "milvus.fullname" . }}
{{- end }}
{{- if .Values.log.persistence.enabled }}
- name: milvus-logs-disk
persistentVolumeClaim:
claimName: {{ .Values.log.persistence.persistentVolumeClaim.existingClaim | default (printf "%s-logs" (include "milvus.fullname" . | trunc 58)) }}
{{- end }}
- name: tools
emptyDir: {}
{{- end }}
23 changes: 23 additions & 0 deletions charts/milvus/templates/streamingnode-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.metrics.enabled }}
{{- if and .Values.streaming.enabled .Values.cluster.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "milvus.streamingnode.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "milvus.labels" . | indent 4 }}
component: "streamingnode"
spec:
type: ClusterIP
clusterIP: None
ports:
- name: metrics
protocol: TCP
port: 9091
targetPort: metrics
selector:
{{ include "milvus.matchLabels" . | indent 4 }}
component: "streamingnode"
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/milvus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ affinity: {}
labels: {}
annotations: {}

# Experimental feature: streaming node
# Only support standalone mode with rocksmq and pulsar message queue,
# cluster mode with pulsar message queue.
# Experimental feature, not recommended for production.
streaming:
enabled: false

##
## If set, the whole config will be mounted from this custom ConfigMap.
## The ConfigMap should have a key named `milvus.yaml` which contains the full Milvus config.
Expand Down Expand Up @@ -466,6 +473,19 @@ mixCoordinator:
labels: {}
clusterIP: ""

streamingNode:
replicas: 1
resources: {}
nodeSelector: {}
affinity: {}
tolerations: []
extraEnv: []
heaptrack:
enabled: false
profiling:
enabled: false # Enable live profiling
strategy: {}

attu:
enabled: false
name: attu
Expand Down

0 comments on commit 8ff49be

Please sign in to comment.