Skip to content

Commit

Permalink
improvment: mysql connection string for sqlalchemy. (#175)
Browse files Browse the repository at this point in the history
* improvment: mysql connection string for sqlalchemy.

Using mysql+pymysql: scheme for SQLALCHEMY_DATABASE_URI.
And then install mysqlclient is not needed for mishards.

Signed-off-by: Ji Bin <[email protected]>

* Upgrade version to 1.1.1

Signed-off-by: Ji Bin <[email protected]>
  • Loading branch information
matrixji authored May 27, 2021
1 parent 022f469 commit 9168914
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
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: "1.1.0"
kubeVersion: "^1.10.0-0"
description: Milvus is an open source similarity search engine for massive-scalefeature vectors.
version: 1.1.0
version: 1.1.1
keywords:
- milvus
- elastic
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Create the name of the service account to use for the mishards component
{{- end -}}
{{- end -}}


{{/* Milvus backend URL */}}
{{- define "milvus.mysqlURI" -}}
{{- if .Values.externalMysql.enabled -}}
Expand All @@ -99,6 +100,14 @@ mysql://root:{{ .Values.mysql.mysqlRootPassword }}@{{ .Release.Name }}-mysql:330
{{- end -}}
{{- end -}}

{{- define "milvus.mysqlURISqlalchemy" -}}
{{- if .Values.externalMysql.enabled -}}
mysql+pymysql://{{ .Values.externalMysql.user }}:{{ .Values.externalMysql.password }}@{{ .Values.externalMysql.ip }}:{{ .Values.externalMysql.port }}/{{ .Values.externalMysql.database }}
{{- else -}}
mysql+pymysql://root:{{ .Values.mysql.mysqlRootPassword }}@{{ .Release.Name }}-mysql:3306/{{ .Values.mysql.mysqlDatabase }}
{{- end -}}
{{- end -}}

{{- define "milvus.sqliteURI" -}}
sqlite://:@:/
{{- end -}}
4 changes: 2 additions & 2 deletions charts/milvus/templates/_mishards_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
MAX_WORKERS={{ .Values.mishards.maxWorkers }}

{{- if or .Values.mysql.enabled .Values.externalMysql.enabled }}
SQLALCHEMY_DATABASE_URI={{ template "milvus.mysqlURI" . }}
SQLALCHEMY_DATABASE_URI={{ template "milvus.mysqlURISqlalchemy" . }}
{{- else }}
SQLALCHEMY_DATABASE_URI={{ template "milvus.sqliteURI" . }}
{{- end }}
Expand Down Expand Up @@ -34,4 +34,4 @@ TRACING_REPORTING_HOST={{ .Values.mishards.trace.tracingReportingHost }}
TRACING_REPORTING_PORT={{ .Values.mishards.trace.tracingReportingPort }}
{{- end -}}

{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/milvus/templates/mishards-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
- 'sh'
- '-c'
- >
pip install mysqlclient && python mishards/main.py
python mishards/main.py
ports:
- name: mishards
containerPort: 19530
Expand Down

0 comments on commit 9168914

Please sign in to comment.