Skip to content

Commit

Permalink
Merge pull request #6 from ganochenkodg/collection-config
Browse files Browse the repository at this point in the history
0.1.5 - support for collection config
  • Loading branch information
ganochenkodg authored Jan 13, 2024
2 parents 44e9b28 + cf5d538 commit efb7da3
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 9 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## qdrant-operator-0.1.5 (2024-01-13)

- Added support for additional collection params with the `spec.config` spec. See the example: [examples/qdrant-collection-complete.yaml].

## qdrant-operator-0.1.4 (2024-01-12)

- Refactor the settingStatus function code.
Expand Down
4 changes: 4 additions & 0 deletions deploy/crds/crd-qdrantcollection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ spec:
onDisk:
type: boolean
default: true
config:
description: "Custom Qdrant collection configuration"
type: object
x-kubernetes-preserve-unknown-fields: true

3 changes: 2 additions & 1 deletion deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ spec:
labels: *labels
spec:
serviceAccountName: qdrant-operator-sa
terminationGracePeriodSeconds: 5
containers:
- name: operator
image: docker.io/dganochenko/qdrant-operator:0.1.4
image: docker.io/dganochenko/qdrant-operator:0.1.5
imagePullPolicy: Always
# debug
# command: ["/bin/sh"]
Expand Down
2 changes: 2 additions & 0 deletions docs/qdrantcollections-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ spec:
- **replicationFactor** (integer, optional): Number of replicas for each shard in the collection.
- **config** (object, optional): Additional configuration for the Qdrant collection, including [indexing](https://qdrant.tech/documentation/concepts/indexing/#vector-index), [quantization](https://qdrant.tech/documentation/guides/quantization/) and [optimizer](https://qdrant.tech/documentation/concepts/optimizer/) parameters.
Feel free to customize the values based on your specific requirements when creating or updating the QdrantCollection custom resource in your Kubernetes cluster.
16 changes: 14 additions & 2 deletions examples/qdrant-collection-complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ metadata:
spec:
cluster: my-cluster
vectorSize: 10
onDisk: true
onDisk: false
shardNumber: 6
replicationFactor: 2

config:
hnsw_config:
m: 16
ef_construct: 100
full_scan_threshold: 10000
optimizers_config:
deleted_threshold: 0.2
vacuum_min_vector_number: 1000
quantization_config:
scalar:
type: int8
quantile: 0.5
always_ram: true
11 changes: 11 additions & 0 deletions examples/qdrant-collection-replication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: qdrant.operator/v1alpha1
kind: QdrantCollection
metadata:
name: my-collection
spec:
cluster: my-cluster
vectorSize: 10
onDisk: true
shardNumber: 6
replicationFactor: 2

10 changes: 8 additions & 2 deletions src/collection-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const createCollection = async (apiObj, k8sCustomApi, k8sCoreApi) => {
k8sCustomApi,
k8sCoreApi
);
const body = {
var body = {
vectors: {
size: apiObj.spec.vectorSize,
distance: 'Cosine',
Expand All @@ -49,6 +49,9 @@ export const createCollection = async (apiObj, k8sCustomApi, k8sCoreApi) => {
shard_number: apiObj.spec.shardNumber,
replication_factor: apiObj.spec.replicationFactor
};
if (typeof apiObj.spec.config !== 'undefined') {
body = { ...body, ...apiObj.spec.config };
}
try {
log(
`Trying to create a Collection "${name}" in the Cluster "${apiObj.spec.cluster}"...`
Expand All @@ -72,7 +75,7 @@ export const updateCollection = async (apiObj, k8sCustomApi, k8sCoreApi) => {
k8sCustomApi,
k8sCoreApi
);
const body = {
var body = {
vectors: {
'': {
size: apiObj.spec.vectorSize,
Expand All @@ -83,6 +86,9 @@ export const updateCollection = async (apiObj, k8sCustomApi, k8sCoreApi) => {
shard_number: apiObj.spec.shardNumber,
replication_factor: apiObj.spec.replicationFactor
};
if (typeof apiObj.spec.config !== 'undefined') {
body = { ...body, ...apiObj.spec.config };
}
try {
log(
`Trying to update a Collection "${name}" in the Cluster "${apiObj.spec.cluster}"...`
Expand Down
4 changes: 2 additions & 2 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qdrant-operator",
"version": "0.1.4",
"version": "0.1.5",
"description": "Kubernetes operator for Qdrant",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/cert-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ openssl req -nodes -sha256 -new -key key.pem \
-extensions v3_req -extfile csr.conf \
-CAcreateserial -out cert.pem 2>/dev/null

echo "Certificates for \"${NAME}\" are ready!"
echo -n "Certificates for \"${NAME}\" are ready!"

0 comments on commit efb7da3

Please sign in to comment.