qdrant-operator 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qdrant_operator-0.2.0/LICENSE +21 -0
- qdrant_operator-0.2.0/PKG-INFO +284 -0
- qdrant_operator-0.2.0/README.md +252 -0
- qdrant_operator-0.2.0/pyproject.toml +98 -0
- qdrant_operator-0.2.0/pyproject.toml.orig +79 -0
- qdrant_operator-0.2.0/src/qdrant_operator/__init__.py +1 -0
- qdrant_operator-0.2.0/src/qdrant_operator/container.py +49 -0
- qdrant_operator-0.2.0/src/qdrant_operator/domain.py +1245 -0
- qdrant_operator-0.2.0/src/qdrant_operator/handlers.py +189 -0
- qdrant_operator-0.2.0/src/qdrant_operator/helm_adapter.py +85 -0
- qdrant_operator-0.2.0/src/qdrant_operator/kubernetes_adapter.py +144 -0
- qdrant_operator-0.2.0/src/qdrant_operator/main.py +48 -0
- qdrant_operator-0.2.0/src/qdrant_operator/ports.py +116 -0
- qdrant_operator-0.2.0/src/qdrant_operator/py.typed +0 -0
- qdrant_operator-0.2.0/src/qdrant_operator/qdrant_adapter.py +124 -0
- qdrant_operator-0.2.0/src/qdrant_operator/s3_adapter.py +113 -0
- qdrant_operator-0.2.0/src/qdrant_operator/usecases.py +597 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mohamed Mustapha Tahrioui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qdrant-operator
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Kubernetes operator for Qdrant vector database
|
|
5
|
+
Keywords: kubernetes,operator,qdrant,kopf,vector-database
|
|
6
|
+
Author: Mohamed Tahrioui
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Environment :: No Input/Output (Daemon)
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Database
|
|
18
|
+
Classifier: Topic :: System :: Clustering
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: kopf[uvloop]>=1.40.0
|
|
21
|
+
Requires-Dist: kubernetes-asyncio>=31.0.0
|
|
22
|
+
Requires-Dist: httpx>=0.28.0
|
|
23
|
+
Requires-Dist: aioboto3>=13.0.0
|
|
24
|
+
Requires-Dist: croniter>=5.0.0
|
|
25
|
+
Requires-Dist: loguru>=0.7.3
|
|
26
|
+
Requires-Python: >=3.12
|
|
27
|
+
Project-URL: Homepage, https://github.com/4thel00z/qdrant-operator
|
|
28
|
+
Project-URL: Repository, https://github.com/4thel00z/qdrant-operator
|
|
29
|
+
Project-URL: Issues, https://github.com/4thel00z/qdrant-operator/issues
|
|
30
|
+
Project-URL: Changelog, https://github.com/4thel00z/qdrant-operator/releases
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<div align="center">
|
|
34
|
+
|
|
35
|
+
<img src="assets/logo.svg" alt="Qdrant Operator logo" width="160">
|
|
36
|
+
|
|
37
|
+
# Qdrant Operator
|
|
38
|
+
|
|
39
|
+
**A Kubernetes operator for managing Qdrant vector database clusters**
|
|
40
|
+
|
|
41
|
+
[](https://github.com/4thel00z/qdrant-operator/actions/workflows/ci.yml)
|
|
42
|
+
[](https://pypi.org/project/qdrant-operator/)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
[](https://opensource.org/licenses/MIT)
|
|
45
|
+
[](https://kubernetes.io/)
|
|
46
|
+
|
|
47
|
+
[Features](#features) •
|
|
48
|
+
[Installation](#installation) •
|
|
49
|
+
[Usage](#usage) •
|
|
50
|
+
[Configuration](#configuration) •
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- **Cluster Management** - Deploy and manage Qdrant clusters via Helm
|
|
59
|
+
- **Automated Backups** - Per-node snapshots streamed to S3-compatible storage, with a manifest
|
|
60
|
+
- **Scheduled Backups** - CronJob-style schedules with concurrency and retention policies
|
|
61
|
+
- **Disaster Recovery** - Restore collections node-by-node from presigned URLs, with optional remapping
|
|
62
|
+
- **Async-First** - Built on kopf with fully async adapters for performance
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
### Prerequisites
|
|
67
|
+
|
|
68
|
+
- Kubernetes cluster (v1.26+)
|
|
69
|
+
- Helm 3.x installed
|
|
70
|
+
- kubectl configured with cluster access
|
|
71
|
+
|
|
72
|
+
### Install with Helm (Recommended)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# From the OCI registry (published on every release)
|
|
76
|
+
helm install qdrant-operator oci://ghcr.io/4thel00z/charts/qdrant-operator -n qdrant-system --create-namespace
|
|
77
|
+
|
|
78
|
+
# Or from the local chart
|
|
79
|
+
helm install qdrant-operator ./charts/qdrant-operator
|
|
80
|
+
|
|
81
|
+
# Or install in a specific namespace
|
|
82
|
+
helm install qdrant-operator ./charts/qdrant-operator -n qdrant-system --create-namespace
|
|
83
|
+
|
|
84
|
+
# Verify installation
|
|
85
|
+
kubectl get pods -l app.kubernetes.io/name=qdrant-operator
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Configuration
|
|
89
|
+
|
|
90
|
+
Override default values:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
helm install qdrant-operator ./charts/qdrant-operator \
|
|
94
|
+
--set operator.logLevel=DEBUG \
|
|
95
|
+
--set resources.limits.memory=512Mi
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Or use a values file:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
helm install qdrant-operator ./charts/qdrant-operator -f my-values.yaml
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Install from PyPI
|
|
105
|
+
The operator is also a Python package; the `qdrant-operator` command runs it against your kubeconfig,
|
|
106
|
+
forwarding any extra flags to `kopf run` (for example `--namespace team-a`).
|
|
107
|
+
```bash
|
|
108
|
+
uv tool install qdrant-operator # or: pipx install qdrant-operator
|
|
109
|
+
qdrant-operator --help
|
|
110
|
+
```
|
|
111
|
+
Container images: `ghcr.io/4thel00z/qdrant-operator:<version>` (linux/amd64, linux/arm64, signed provenance).
|
|
112
|
+
### Build Docker Image (Optional)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Replace with your registry
|
|
116
|
+
docker build -t ghcr.io/YOUR_ORG/qdrant-operator:0.1.0 .
|
|
117
|
+
docker push ghcr.io/YOUR_ORG/qdrant-operator:0.1.0
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Local Development
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Install dependencies
|
|
124
|
+
uv sync
|
|
125
|
+
|
|
126
|
+
# Apply CRDs to cluster
|
|
127
|
+
kubectl apply -f manifests/crds/
|
|
128
|
+
|
|
129
|
+
# Run operator locally against your kubeconfig
|
|
130
|
+
make dev
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Usage
|
|
134
|
+
|
|
135
|
+
### Create a Qdrant Cluster
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
apiVersion: qdrant.io/v1alpha1
|
|
139
|
+
kind: QdrantCluster
|
|
140
|
+
metadata:
|
|
141
|
+
name: my-qdrant
|
|
142
|
+
namespace: default
|
|
143
|
+
spec:
|
|
144
|
+
replicas: 3
|
|
145
|
+
version: v1.16.3
|
|
146
|
+
resources:
|
|
147
|
+
requests:
|
|
148
|
+
cpu: "500m"
|
|
149
|
+
memory: "1Gi"
|
|
150
|
+
limits:
|
|
151
|
+
cpu: "2"
|
|
152
|
+
memory: "4Gi"
|
|
153
|
+
persistence:
|
|
154
|
+
size: 10Gi
|
|
155
|
+
storageClassName: standard
|
|
156
|
+
cluster:
|
|
157
|
+
enabled: true
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Create a Backup
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
apiVersion: qdrant.io/v1alpha1
|
|
164
|
+
kind: QdrantBackup
|
|
165
|
+
metadata:
|
|
166
|
+
name: my-backup
|
|
167
|
+
namespace: default
|
|
168
|
+
spec:
|
|
169
|
+
clusterRef:
|
|
170
|
+
name: my-qdrant
|
|
171
|
+
storage:
|
|
172
|
+
s3:
|
|
173
|
+
bucket: my-backups
|
|
174
|
+
prefix: qdrant
|
|
175
|
+
region: us-east-1
|
|
176
|
+
credentialsSecretRef:
|
|
177
|
+
name: s3-credentials
|
|
178
|
+
accessKeyIdKey: AWS_ACCESS_KEY_ID
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Schedule Automated Backups
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
apiVersion: qdrant.io/v1alpha1
|
|
185
|
+
kind: QdrantBackupSchedule
|
|
186
|
+
metadata:
|
|
187
|
+
name: daily-backup
|
|
188
|
+
namespace: default
|
|
189
|
+
spec:
|
|
190
|
+
schedule: "0 2 * * *" # Daily at 2 AM
|
|
191
|
+
clusterRef:
|
|
192
|
+
name: my-qdrant
|
|
193
|
+
storage:
|
|
194
|
+
s3:
|
|
195
|
+
bucket: my-backups
|
|
196
|
+
prefix: scheduled
|
|
197
|
+
region: us-east-1
|
|
198
|
+
credentialsSecretRef:
|
|
199
|
+
name: s3-credentials
|
|
200
|
+
accessKeyIdKey: AWS_ACCESS_KEY_ID
|
|
201
|
+
retentionPolicy:
|
|
202
|
+
keepLast: 7
|
|
203
|
+
keepDaily: 30
|
|
204
|
+
concurrencyPolicy: Forbid
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Restore from Backup
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
apiVersion: qdrant.io/v1alpha1
|
|
211
|
+
kind: QdrantRestore
|
|
212
|
+
metadata:
|
|
213
|
+
name: my-restore
|
|
214
|
+
namespace: default
|
|
215
|
+
spec:
|
|
216
|
+
backupRef:
|
|
217
|
+
name: my-backup
|
|
218
|
+
targetClusterRef:
|
|
219
|
+
name: my-qdrant-new
|
|
220
|
+
collectionMapping:
|
|
221
|
+
old_collection: new_collection
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Configuration
|
|
225
|
+
|
|
226
|
+
### Environment Variables
|
|
227
|
+
|
|
228
|
+
| Variable | Description | Default |
|
|
229
|
+
|----------|-------------|---------|
|
|
230
|
+
| `KUBECONFIG` | Path to kubeconfig file | In-cluster config |
|
|
231
|
+
| `LOG_LEVEL` | Logging level | `INFO` |
|
|
232
|
+
| `LOG_FORMAT` | `json` or `text` | `json` |
|
|
233
|
+
|
|
234
|
+
### S3 Credentials Secret
|
|
235
|
+
|
|
236
|
+
```yaml
|
|
237
|
+
apiVersion: v1
|
|
238
|
+
kind: Secret
|
|
239
|
+
metadata:
|
|
240
|
+
name: s3-credentials
|
|
241
|
+
type: Opaque
|
|
242
|
+
stringData:
|
|
243
|
+
AWS_ACCESS_KEY_ID: "your-access-key"
|
|
244
|
+
AWS_SECRET_ACCESS_KEY: "your-secret-key"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Development
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Install dependencies
|
|
251
|
+
uv sync
|
|
252
|
+
|
|
253
|
+
# Run tests
|
|
254
|
+
uv run pytest
|
|
255
|
+
|
|
256
|
+
# Run integration tests (requires k8s cluster + helm)
|
|
257
|
+
make test-integration
|
|
258
|
+
|
|
259
|
+
# Lint and format
|
|
260
|
+
uv run ruff check src tests
|
|
261
|
+
uv run ruff format src tests
|
|
262
|
+
|
|
263
|
+
# Type checking
|
|
264
|
+
uv run pyright src tests
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Releasing
|
|
268
|
+
CI (`.github/workflows/ci.yml`) runs lint, pyright, unit tests, chart lint, a wheel/image build and the
|
|
269
|
+
kind-based end-to-end suite on every push and pull request.
|
|
270
|
+
|
|
271
|
+
Releases are driven by [release-please](https://github.com/googleapis/release-please) from the
|
|
272
|
+
conventional commit history, all inside `.github/workflows/release.yml` on pushes to `main`:
|
|
273
|
+
|
|
274
|
+
1. A release PR is kept up to date that bumps `pyproject.toml` and `Chart.yaml`, refreshes `uv.lock`
|
|
275
|
+
and updates `CHANGELOG.md`.
|
|
276
|
+
2. Merging that PR creates the `vX.Y.Z` tag and the GitHub release, and the same run publishes the
|
|
277
|
+
wheel and sdist to PyPI (trusted publishing, no token), pushes the multi-arch image and the Helm
|
|
278
|
+
chart to ghcr.io, and attaches the artifacts and CRDs to the release.
|
|
279
|
+
|
|
280
|
+
No secrets are involved beyond the default `GITHUB_TOKEN`; the repository setting *Allow GitHub
|
|
281
|
+
Actions to create and approve pull requests* must be on for the release PR to appear.
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/logo.svg" alt="Qdrant Operator logo" width="160">
|
|
4
|
+
|
|
5
|
+
# Qdrant Operator
|
|
6
|
+
|
|
7
|
+
**A Kubernetes operator for managing Qdrant vector database clusters**
|
|
8
|
+
|
|
9
|
+
[](https://github.com/4thel00z/qdrant-operator/actions/workflows/ci.yml)
|
|
10
|
+
[](https://pypi.org/project/qdrant-operator/)
|
|
11
|
+
[](https://www.python.org/downloads/)
|
|
12
|
+
[](https://opensource.org/licenses/MIT)
|
|
13
|
+
[](https://kubernetes.io/)
|
|
14
|
+
|
|
15
|
+
[Features](#features) •
|
|
16
|
+
[Installation](#installation) •
|
|
17
|
+
[Usage](#usage) •
|
|
18
|
+
[Configuration](#configuration) •
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Cluster Management** - Deploy and manage Qdrant clusters via Helm
|
|
27
|
+
- **Automated Backups** - Per-node snapshots streamed to S3-compatible storage, with a manifest
|
|
28
|
+
- **Scheduled Backups** - CronJob-style schedules with concurrency and retention policies
|
|
29
|
+
- **Disaster Recovery** - Restore collections node-by-node from presigned URLs, with optional remapping
|
|
30
|
+
- **Async-First** - Built on kopf with fully async adapters for performance
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### Prerequisites
|
|
35
|
+
|
|
36
|
+
- Kubernetes cluster (v1.26+)
|
|
37
|
+
- Helm 3.x installed
|
|
38
|
+
- kubectl configured with cluster access
|
|
39
|
+
|
|
40
|
+
### Install with Helm (Recommended)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# From the OCI registry (published on every release)
|
|
44
|
+
helm install qdrant-operator oci://ghcr.io/4thel00z/charts/qdrant-operator -n qdrant-system --create-namespace
|
|
45
|
+
|
|
46
|
+
# Or from the local chart
|
|
47
|
+
helm install qdrant-operator ./charts/qdrant-operator
|
|
48
|
+
|
|
49
|
+
# Or install in a specific namespace
|
|
50
|
+
helm install qdrant-operator ./charts/qdrant-operator -n qdrant-system --create-namespace
|
|
51
|
+
|
|
52
|
+
# Verify installation
|
|
53
|
+
kubectl get pods -l app.kubernetes.io/name=qdrant-operator
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Configuration
|
|
57
|
+
|
|
58
|
+
Override default values:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
helm install qdrant-operator ./charts/qdrant-operator \
|
|
62
|
+
--set operator.logLevel=DEBUG \
|
|
63
|
+
--set resources.limits.memory=512Mi
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or use a values file:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
helm install qdrant-operator ./charts/qdrant-operator -f my-values.yaml
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Install from PyPI
|
|
73
|
+
The operator is also a Python package; the `qdrant-operator` command runs it against your kubeconfig,
|
|
74
|
+
forwarding any extra flags to `kopf run` (for example `--namespace team-a`).
|
|
75
|
+
```bash
|
|
76
|
+
uv tool install qdrant-operator # or: pipx install qdrant-operator
|
|
77
|
+
qdrant-operator --help
|
|
78
|
+
```
|
|
79
|
+
Container images: `ghcr.io/4thel00z/qdrant-operator:<version>` (linux/amd64, linux/arm64, signed provenance).
|
|
80
|
+
### Build Docker Image (Optional)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Replace with your registry
|
|
84
|
+
docker build -t ghcr.io/YOUR_ORG/qdrant-operator:0.1.0 .
|
|
85
|
+
docker push ghcr.io/YOUR_ORG/qdrant-operator:0.1.0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Local Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Install dependencies
|
|
92
|
+
uv sync
|
|
93
|
+
|
|
94
|
+
# Apply CRDs to cluster
|
|
95
|
+
kubectl apply -f manifests/crds/
|
|
96
|
+
|
|
97
|
+
# Run operator locally against your kubeconfig
|
|
98
|
+
make dev
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
### Create a Qdrant Cluster
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
apiVersion: qdrant.io/v1alpha1
|
|
107
|
+
kind: QdrantCluster
|
|
108
|
+
metadata:
|
|
109
|
+
name: my-qdrant
|
|
110
|
+
namespace: default
|
|
111
|
+
spec:
|
|
112
|
+
replicas: 3
|
|
113
|
+
version: v1.16.3
|
|
114
|
+
resources:
|
|
115
|
+
requests:
|
|
116
|
+
cpu: "500m"
|
|
117
|
+
memory: "1Gi"
|
|
118
|
+
limits:
|
|
119
|
+
cpu: "2"
|
|
120
|
+
memory: "4Gi"
|
|
121
|
+
persistence:
|
|
122
|
+
size: 10Gi
|
|
123
|
+
storageClassName: standard
|
|
124
|
+
cluster:
|
|
125
|
+
enabled: true
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Create a Backup
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
apiVersion: qdrant.io/v1alpha1
|
|
132
|
+
kind: QdrantBackup
|
|
133
|
+
metadata:
|
|
134
|
+
name: my-backup
|
|
135
|
+
namespace: default
|
|
136
|
+
spec:
|
|
137
|
+
clusterRef:
|
|
138
|
+
name: my-qdrant
|
|
139
|
+
storage:
|
|
140
|
+
s3:
|
|
141
|
+
bucket: my-backups
|
|
142
|
+
prefix: qdrant
|
|
143
|
+
region: us-east-1
|
|
144
|
+
credentialsSecretRef:
|
|
145
|
+
name: s3-credentials
|
|
146
|
+
accessKeyIdKey: AWS_ACCESS_KEY_ID
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Schedule Automated Backups
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
apiVersion: qdrant.io/v1alpha1
|
|
153
|
+
kind: QdrantBackupSchedule
|
|
154
|
+
metadata:
|
|
155
|
+
name: daily-backup
|
|
156
|
+
namespace: default
|
|
157
|
+
spec:
|
|
158
|
+
schedule: "0 2 * * *" # Daily at 2 AM
|
|
159
|
+
clusterRef:
|
|
160
|
+
name: my-qdrant
|
|
161
|
+
storage:
|
|
162
|
+
s3:
|
|
163
|
+
bucket: my-backups
|
|
164
|
+
prefix: scheduled
|
|
165
|
+
region: us-east-1
|
|
166
|
+
credentialsSecretRef:
|
|
167
|
+
name: s3-credentials
|
|
168
|
+
accessKeyIdKey: AWS_ACCESS_KEY_ID
|
|
169
|
+
retentionPolicy:
|
|
170
|
+
keepLast: 7
|
|
171
|
+
keepDaily: 30
|
|
172
|
+
concurrencyPolicy: Forbid
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Restore from Backup
|
|
176
|
+
|
|
177
|
+
```yaml
|
|
178
|
+
apiVersion: qdrant.io/v1alpha1
|
|
179
|
+
kind: QdrantRestore
|
|
180
|
+
metadata:
|
|
181
|
+
name: my-restore
|
|
182
|
+
namespace: default
|
|
183
|
+
spec:
|
|
184
|
+
backupRef:
|
|
185
|
+
name: my-backup
|
|
186
|
+
targetClusterRef:
|
|
187
|
+
name: my-qdrant-new
|
|
188
|
+
collectionMapping:
|
|
189
|
+
old_collection: new_collection
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Configuration
|
|
193
|
+
|
|
194
|
+
### Environment Variables
|
|
195
|
+
|
|
196
|
+
| Variable | Description | Default |
|
|
197
|
+
|----------|-------------|---------|
|
|
198
|
+
| `KUBECONFIG` | Path to kubeconfig file | In-cluster config |
|
|
199
|
+
| `LOG_LEVEL` | Logging level | `INFO` |
|
|
200
|
+
| `LOG_FORMAT` | `json` or `text` | `json` |
|
|
201
|
+
|
|
202
|
+
### S3 Credentials Secret
|
|
203
|
+
|
|
204
|
+
```yaml
|
|
205
|
+
apiVersion: v1
|
|
206
|
+
kind: Secret
|
|
207
|
+
metadata:
|
|
208
|
+
name: s3-credentials
|
|
209
|
+
type: Opaque
|
|
210
|
+
stringData:
|
|
211
|
+
AWS_ACCESS_KEY_ID: "your-access-key"
|
|
212
|
+
AWS_SECRET_ACCESS_KEY: "your-secret-key"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Development
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Install dependencies
|
|
219
|
+
uv sync
|
|
220
|
+
|
|
221
|
+
# Run tests
|
|
222
|
+
uv run pytest
|
|
223
|
+
|
|
224
|
+
# Run integration tests (requires k8s cluster + helm)
|
|
225
|
+
make test-integration
|
|
226
|
+
|
|
227
|
+
# Lint and format
|
|
228
|
+
uv run ruff check src tests
|
|
229
|
+
uv run ruff format src tests
|
|
230
|
+
|
|
231
|
+
# Type checking
|
|
232
|
+
uv run pyright src tests
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Releasing
|
|
236
|
+
CI (`.github/workflows/ci.yml`) runs lint, pyright, unit tests, chart lint, a wheel/image build and the
|
|
237
|
+
kind-based end-to-end suite on every push and pull request.
|
|
238
|
+
|
|
239
|
+
Releases are driven by [release-please](https://github.com/googleapis/release-please) from the
|
|
240
|
+
conventional commit history, all inside `.github/workflows/release.yml` on pushes to `main`:
|
|
241
|
+
|
|
242
|
+
1. A release PR is kept up to date that bumps `pyproject.toml` and `Chart.yaml`, refreshes `uv.lock`
|
|
243
|
+
and updates `CHANGELOG.md`.
|
|
244
|
+
2. Merging that PR creates the `vX.Y.Z` tag and the GitHub release, and the same run publishes the
|
|
245
|
+
wheel and sdist to PyPI (trusted publishing, no token), pushes the multi-arch image and the Helm
|
|
246
|
+
chart to ghcr.io, and attaches the artifacts and CRDs to the release.
|
|
247
|
+
|
|
248
|
+
No secrets are involved beyond the default `GITHUB_TOKEN`; the repository setting *Allow GitHub
|
|
249
|
+
Actions to create and approve pull requests* must be on for the release PR to appear.
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "qdrant-operator"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Kubernetes operator for Qdrant vector database"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
keywords = [
|
|
9
|
+
"kubernetes",
|
|
10
|
+
"operator",
|
|
11
|
+
"qdrant",
|
|
12
|
+
"kopf",
|
|
13
|
+
"vector-database",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: No Input/Output (Daemon)",
|
|
18
|
+
"Framework :: AsyncIO",
|
|
19
|
+
"Intended Audience :: System Administrators",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Database",
|
|
25
|
+
"Topic :: System :: Clustering",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
requires-python = ">=3.12"
|
|
29
|
+
dependencies = [
|
|
30
|
+
"kopf[uvloop]>=1.40.0",
|
|
31
|
+
"kubernetes-asyncio>=31.0.0",
|
|
32
|
+
"httpx>=0.28.0",
|
|
33
|
+
"aioboto3>=13.0.0",
|
|
34
|
+
"croniter>=5.0.0",
|
|
35
|
+
"loguru>=0.7.3",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[[project.authors]]
|
|
39
|
+
name = "Mohamed Tahrioui"
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/4thel00z/qdrant-operator"
|
|
43
|
+
Repository = "https://github.com/4thel00z/qdrant-operator"
|
|
44
|
+
Issues = "https://github.com/4thel00z/qdrant-operator/issues"
|
|
45
|
+
Changelog = "https://github.com/4thel00z/qdrant-operator/releases"
|
|
46
|
+
|
|
47
|
+
[project.scripts]
|
|
48
|
+
qdrant-operator = "qdrant_operator.main:run"
|
|
49
|
+
|
|
50
|
+
[dependency-groups]
|
|
51
|
+
dev = [
|
|
52
|
+
"pytest>=8.3.0",
|
|
53
|
+
"pytest-asyncio>=0.25.0",
|
|
54
|
+
"pytest-cov>=6.0.0",
|
|
55
|
+
"ruff>=0.9.0",
|
|
56
|
+
"pyright>=1.1.0",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["uv_build>=0.8,<1.0"]
|
|
61
|
+
build-backend = "uv_build"
|
|
62
|
+
|
|
63
|
+
[tool.uv]
|
|
64
|
+
package = true
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
line-length = 100
|
|
68
|
+
target-version = "py312"
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint]
|
|
71
|
+
select = [
|
|
72
|
+
"E",
|
|
73
|
+
"F",
|
|
74
|
+
"I",
|
|
75
|
+
"N",
|
|
76
|
+
"W",
|
|
77
|
+
"UP",
|
|
78
|
+
"B",
|
|
79
|
+
"C4",
|
|
80
|
+
"SIM",
|
|
81
|
+
"ARG",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
[tool.ruff.lint.per-file-ignores]
|
|
85
|
+
"tests/fakes.py" = ["ARG002"]
|
|
86
|
+
|
|
87
|
+
[tool.ruff.lint.isort]
|
|
88
|
+
force-single-line = true
|
|
89
|
+
|
|
90
|
+
[tool.pyright]
|
|
91
|
+
pythonVersion = "3.12"
|
|
92
|
+
typeCheckingMode = "strict"
|
|
93
|
+
reportMissingTypeStubs = false
|
|
94
|
+
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
asyncio_mode = "auto"
|
|
97
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
98
|
+
markers = ["integration: needs a reachable Kubernetes cluster and helm (set QDRANT_OPERATOR_INTEGRATION=1)"]
|