---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: qdrant
  namespace: gitea-assistant
  labels:
    app.kubernetes.io/name: qdrant
    app.kubernetes.io/part-of: gitea-assistant
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: qdrant
  template:
    metadata:
      labels:
        app.kubernetes.io/name: qdrant
        app.kubernetes.io/part-of: gitea-assistant
    spec:
      containers:
        - name: qdrant
          image: qdrant/qdrant:latest
          ports:
            - name: http
              containerPort: 6333
              protocol: TCP
            - name: grpc
              containerPort: 6334
              protocol: TCP
          resources:
            limits:
              memory: "1Gi"
            requests:
              memory: "512Mi"
              cpu: "250m"
          volumeMounts:
            - name: qdrant-storage
              mountPath: /qdrant/storage
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 10
            periodSeconds: 30
            timeoutSeconds: 5
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 5
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
      volumes:
        - name: qdrant-storage
          hostPath:
            # Customize this path to match your node's storage layout
            path: /opt/gitea-assistant/qdrant
            type: DirectoryOrCreate

---
apiVersion: v1
kind: Service
metadata:
  name: qdrant
  namespace: gitea-assistant
  labels:
    app.kubernetes.io/name: qdrant
    app.kubernetes.io/part-of: gitea-assistant
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: qdrant
  ports:
    - name: http
      port: 6333
      targetPort: http
      protocol: TCP
    - name: grpc
      port: 6334
      targetPort: grpc
      protocol: TCP
