apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jellyfin-meilisearch
  labels:
    helm.sh/chart: meilisearch-0.32.0
    app.kubernetes.io/name: meilisearch
    app.kubernetes.io/instance: jellyfin
    app.kubernetes.io/version: "v1.42.1"
    app.kubernetes.io/component: search-engine
    app.kubernetes.io/part-of: meilisearch
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  serviceName: jellyfin-meilisearch
  selector:
    matchLabels:
      app.kubernetes.io/name: meilisearch
      app.kubernetes.io/instance: jellyfin
  template:
    metadata:
      labels:
        helm.sh/chart: meilisearch-0.32.0
        app.kubernetes.io/name: meilisearch
        app.kubernetes.io/instance: jellyfin
        app.kubernetes.io/version: "v1.42.1"
        app.kubernetes.io/component: search-engine
        app.kubernetes.io/part-of: meilisearch
        app.kubernetes.io/managed-by: Helm
      annotations:
        checksum/config: 8cf40bc1515eb695a252da29c5c3f2842ad546dacb910115dd74902d52c775a8
    spec:
      serviceAccountName: jellyfin-meilisearch
      securityContext:
        fsGroup: 1000
        fsGroupChangePolicy: OnRootMismatch
        runAsGroup: 1000
        runAsNonRoot: true
        runAsUser: 1000
      volumes:
        - name: tmp
          emptyDir: {}
        - name: data
          persistentVolumeClaim:
            claimName: jellyfin-meilisearch
      containers:
        - name: meilisearch
          image: "getmeili/meilisearch:v1.42.1"
          imagePullPolicy: IfNotPresent
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            readOnlyRootFilesystem: true
          volumeMounts:
            - name: tmp
              mountPath: /tmp
            - name: data
              mountPath: /meili_data
          envFrom:
            - configMapRef:
                name: jellyfin-meilisearch-environment
            - secretRef:
                name: jellyfin-meilisearch-key
          ports:
            - name: http
              containerPort: 7700
              protocol: TCP
          startupProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 1
            initialDelaySeconds: 1
            failureThreshold: 60
            timeoutSeconds: 1
          livenessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 10
            initialDelaySeconds: 0
            timeoutSeconds: 10
          readinessProbe:
            httpGet:
              path: /health
              port: http
            periodSeconds: 10
            initialDelaySeconds: 0
            timeoutSeconds: 10
          resources:
            requests:
              cpu: 10m
              memory: 1Gi
