---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: solr
  labels:
    app.kubernetes.io/name: solr
    app.kubernetes.io/version: "4.16"
    app.kubernetes.io/component: searchindex
    app.kubernetes.io/part-of: dataverse
    app.kubernetes.io/managed-by: kubectl
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: solr
      app.kubernetes.io/part-of: dataverse
  revisionHistoryLimit: 1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: solr
        app.kubernetes.io/part-of: dataverse
    spec:
      containers:
        - name: solr
          image: iqss/solr-k8s
          ports:
            - containerPort: 8983
          volumeMounts:
            - name: data
              mountPath: /opt/solr/server/solr/collection1/data
          env:
            - name: SOLR_PORT  # Otherwise, this is wrongfully set by K8s.
              value: "8983"
          readinessProbe:
            httpGet:
              path: /solr/collection1/admin/ping
              port: 8983
      initContainers:
        - name: volume-mount-hack
          image: giantswarm/tiny-tools
          command: ["sh", "-c", "chown -c 8983:8983 /data"]
          volumeMounts:
          - name: data
            mountPath: /data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: solr
