Skip to content

Commit

Permalink
chore: upgrade weaviate addon to v1.0 API (#1193)
Browse files Browse the repository at this point in the history
Co-authored-by: Y-Rookie <[email protected]>
(cherry picked from commit b57793c)
  • Loading branch information
Y-Rookie committed Nov 14, 2024
1 parent aaaa5c1 commit d7e0f44
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 921 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ KubeBlocks add-ons.
| tdengine | tdengine-3.0.5 | TDengine is an open source, high-performance, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, Industrial IoT and DevOps. | leon-inf |
| tidb | tidb-6.5.10<br>tidb-7.1.5<br>tidb-7.5.2<br>tidb-pd-6.5.10<br>tidb-pd-7.1.5<br>tidb-pd-7.5.2<br>tikv-6.5.10<br>tikv-7.1.5<br>tikv-7.5.2 | TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. | csuzhangxc cjc7373 |
| victoria-metrics | ictoria-metrics-1.0.0 | VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. | sophon-zt ButterBright |
| weaviate | weaviate-1.23.1 | Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML-models, and scale seamlessly into billions of data objects. | iziang |
| weaviate | weaviate-1.19.6 | Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML-models, and scale seamlessly into billions of data objects. | iziang |
| yashandb | yashandb-personal-23.1.1.100 | YashanDB is a new database system completely independently designed and developed by SICS. Based on classical database theories, it incorporates original Bounded Evaluation theory, Approximation theory, Parallel Scalability theory and Cross-Modal Fusion Computation theory, supports multiple deployment methods such as stand-alone/primary-standby, shared cluster, and distributed ones, covers OLTP/HTAP/OLAP transactions and analyzes mixed load scenarios, and is fully compatible with privatization and cloud infrastructure, providing clients with one-stop enterprise-level converged data management solutions to meet the needs of key industries such as finance, government, telecommunications and energy for high performance, concurrency and security. | JesseAtSZ shanshanying |
| zookeeper | zookeeper-3.4.14<br>zookeeper-3.6.4<br>zookeeper-3.7.2<br>zookeeper-3.8.4<br>zookeeper-3.9.2 | Apache ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. | kubeJocker kissycn |
8 changes: 7 additions & 1 deletion addons-cluster/weaviate/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ type: application

version: 1.0.0-alpha.0

appVersion: "1.18.0"
dependencies:
- name: kblib
version: 0.1.2
repository: file://../kblib
alias: extra

appVersion: "1.19.6"
6 changes: 1 addition & 5 deletions addons-cluster/weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ app.kubernetes.io/name: {{ include "weaviate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "clustername" -}}
{{ include "weaviate.fullname" .}}
{{- end}}

{{/*
Create the name of the service account to use
*/}}
{{- define "weaviate.serviceAccountName" -}}
{{- default (printf "kb-%s" (include "clustername" .)) .Values.serviceAccount.name }}
{{- default (printf "kb-%s" (include "kblib.clusterName" .)) .Values.serviceAccount.name }}
{{- end }}
2 changes: 1 addition & 1 deletion addons-cluster/weaviate/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: {{ include "clustername" . }}
name: {{ include "kblib.clusterName" . }}
labels: {{ include "weaviate.labels" . | nindent 4 }}
spec:
terminationPolicy: {{ .Values.terminationPolicy }}
Expand Down
2 changes: 2 additions & 0 deletions addons-cluster/weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# Declare variables to be passed into your templates.

replicaCount: 1

terminationPolicy: Delete

nameOverride: ""

fullnameOverride: ""

resources: { }
Expand Down
4 changes: 2 additions & 2 deletions addons/weaviate/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: application
version: 1.0.0-alpha.0

# This is the version number of weaviate.
appVersion: "1.18.0"
appVersion: "1.19.6"

home: https://weaviate.tech/
icon: https://weaviate.tech/images/logo_with_text.svg
Expand All @@ -23,6 +23,6 @@ sources:
- https://github.com/apecloud/kubeblocks/

annotations:
addon.kubeblocks.io/kubeblocks-version: ">=0.9.0"
addon.kubeblocks.io/kubeblocks-version: ">=1.0.0"
addon.kubeblocks.io/model: "vector"
addon.kubeblocks.io/provider: "community"
41 changes: 36 additions & 5 deletions addons/weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,45 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Define component definition name
Common weaviate annotations
*/}}
{{- define "weaviate.annotations" -}}
helm.sh/resource-policy: keep
{{- end }}

{{/*
Define weaviate component definition name
*/}}
{{- define "weaviate.componentDefName" -}}
{{- if eq (len .Values.compDefinitionVersionSuffix) 0 -}}
weaviate
{{- else -}}
{{- printf "weaviate-%s" .Values.compDefinitionVersionSuffix -}}
weaviate-{{ .Chart.Version }}
{{- end -}}

{{/*
Define weaviate component definition regex pattern name
*/}}
{{- define "weaviate.cmpdRegexpPattern" -}}
^weaviate-
{{- end -}}

{{/*
Define weaviate config template name
*/}}
{{- define "weaviate.configTplName" -}}
weaviate-config-template
{{- end -}}

{{/*
Define weaviate env config template name
*/}}
{{- define "weaviate.envConfigTplName" -}}
weaviate-env-config-template
{{- end -}}

{{/*
Define weaviate env config constraint name
*/}}
{{- define "weaviate.envConfigConstraintTplName" -}}
weaviate-env-constraints
{{- end -}}

{{/*
Expand Down
4 changes: 2 additions & 2 deletions addons/weaviate/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
labels:
{{- include "weaviate.labels" . | nindent 4 }}
spec:
serviceKind: Weaviate
serviceKind: weaviate
compDefs:
- {{ include "weaviate.componentDefName" . }}
- {{ include "weaviate.cmpdRegexpPattern" . }}
backupMethods:
- name: volume-snapshot
snapshotVolumes: true
Expand Down
46 changes: 34 additions & 12 deletions addons/weaviate/templates/cmpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ metadata:
name: {{ include "weaviate.componentDefName" . }}
labels:
{{- include "weaviate.labels" . | nindent 4 }}
annotations:
{{- include "weaviate.annotations" . | nindent 4 }}
spec:
provider: kubeblocks
description: Weaviate is an open source vector database that is robust, scalable, cloud-native, and fast.
serviceKind: weaviate
serviceVersion: 1.23.1
serviceVersion: 1.19.6
services:
- name: node-discovery
serviceName: node-discovery
Expand All @@ -25,16 +27,35 @@ spec:
needSnapshot: true
configs:
- name: weaviate-config-template
templateRef: weaviate-config-template
templateRef: {{ include "weaviate.configTplName" . }}
namespace: {{ .Release.Namespace }}
volumeName: weaviate-config
- name: weaviate-env-template
templateRef: weaviate-env-template
templateRef: {{ include "weaviate.envConfigTplName" . }}
namespace: {{ .Release.Namespace }}
constraintRef: weaviate-env-constraints
constraintRef: {{ include "weaviate.envConfigConstraintTplName" . }}
volumeName: weaviate-env
defaultMode: 0444
vars:
- name: WEAVIATE_COMPONENT_NAME
valueFrom:
componentVarRef:
optional: false
componentName: Required
- name: CLUSTER_NAMESPACE
valueFrom:
clusterVarRef:
namespace: Required
- name: CLUSTER_DOMAIN
value: {{ .Values.clusterDomain | quote }}
- name: WEAVIATE_COMPONENT_POD_LIST
valueFrom:
componentVarRef:
optional: false
podNames: Optional
runtime:
dnsPolicy: ClusterFirst
enableServiceLinks: true
containers:
- name: weaviate
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:{{ .Values.images.tag | default "latest" }}
Expand All @@ -43,17 +64,17 @@ spec:
- /bin/sh
- -c
- |
replicas=$(eval echo ${KB_POD_LIST} | tr ',' '\n')
replicas=$(echo ${WEAVIATE_COMPONENT_POD_LIST} | tr ',' '\n')
# Initialize count
replca_count=0
replica_count=0
# Use a for loop to iterate over each space-separated word
for item in $replicas; do
replca_count=$((replca_count + 1))
replica_count=$((replica_count + 1))
done
while true; do
count=$(nslookup ${CLUSTER_JOIN} | awk '/^Address: / { print $2 }' | wc -l)
if [ "$count" -eq ${replca_count} ]; then
if [ "$count" -eq ${replica_count} ]; then
break
fi
echo "Waiting for all nodes to be running..."
Expand Down Expand Up @@ -101,8 +122,6 @@ spec:
name: weaviate-env
- mountPath: /var/lib/weaviate
name: data
dnsPolicy: ClusterFirst
enableServiceLinks: true
ports:
- name: tcp-weaviate
containerPort: 8080
Expand Down Expand Up @@ -134,6 +153,9 @@ spec:
- name: DEFAULT_VECTORIZER_MODULE
value: none
- name: CLUSTER_HOSTNAME
value: "$(KB_POD_NAME)"
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: CLUSTER_JOIN
value: $(KB_CLUSTER_COMP_NAME)-node-discovery.$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}
value: $(WEAVIATE_COMPONENT_NAME)-node-discovery.$(CLUSTER_NAMESPACE).svc$(CLUSTER_DOMAIN)
17 changes: 17 additions & 0 deletions addons/weaviate/templates/cmpv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apps.kubeblocks.io/v1
kind: ComponentVersion
metadata:
name: weaviate
labels:
{{- include "weaviate.labels" . | nindent 4 }}
spec:
compatibilityRules:
- releases:
- 1.19.6
compDefs:
- {{ include "weaviate.cmpdRegexpPattern" . }}
releases:
- name: 1.19.6
serviceVersion: 1.19.6
images:
minio: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.repository }}:1.19.6
2 changes: 1 addition & 1 deletion addons/weaviate/templates/configconstraint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1beta1
kind: ConfigConstraint
metadata:
name: weaviate-env-constraints
name: {{ include "weaviate.envConfigConstraintTplName" . }}
labels:
{{- include "weaviate.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: weaviate-config-template
name: {{ include "weaviate.configTplName" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "weaviate.labels" . | nindent 4 }}

data:
conf.yaml: |-
---
Expand All @@ -23,11 +22,10 @@ data:
apiVersion: v1
kind: ConfigMap
metadata:
name: weaviate-env-template
name: {{ include "weaviate.envConfigTplName" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "weaviate.labels" . | nindent 4 }}

data:
envs: |-
ENABLE_MODULES=""
Expand Down
Loading

0 comments on commit d7e0f44

Please sign in to comment.