---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: chia
  namespace: chia
  labels:
    app.kubernetes.io/instance: chia
    app.kubernetes.io/name: chia
spec:
  replicas: 1
  revisionHistoryLimit: 3
  updateStrategy:
    type: RollingUpdate
  serviceName: chia
  selector:
    matchLabels:
      app.kubernetes.io/instance: chia
      app.kubernetes.io/name: chia
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: chia
        app.kubernetes.io/name: chia
      annotations:
        secret.reloader.stakater.com/reload: chia-secrets
    spec:
      nodeSelector:
        kubernetes.io/arch: amd64
      automountServiceAccountToken: false
      containers:
      - name: chia
        image: ghcr.io/chia-network/chia:1.2.11
        env:
        - name: keys
          value: /priv/keys
        - name: TZ
          value: America/Chicago
        - name: plots_dir
          value: /plots:/plots2
        - name: upnp
          value: "false"
        livenessProbe:
          tcpSocket:
            port: 8444
          initialDelaySeconds: 15
          periodSeconds: 10
        startupProbe:
          tcpSocket:
            port: 8444
          failureThreshold: 60
          periodSeconds: 5
        volumeMounts:
        - name: priv
          mountPath: /priv
          readOnly: true
        - mountPath: /root/.chia
          name: chia-config
        - mountPath: /plots
          name: plots
          readOnly: true
        - mountPath: /plots2
          name: plots2
          readOnly: true
      volumes:
      - name: plots
        nfs:
          path: /volume1/Complete/chia
          server: ${DERPNAS_ADDR}
      - name: plots2
        nfs:
          path: /volume1/chia
          server: ${RACKNAS_ADDR}
      - name: priv
        secret:
          secretName: chia-secrets
          defaultMode: 0400
  volumeClaimTemplates:
  - metadata:
      name: chia-config
    spec:
      accessModes:
      - ReadWriteOnce
      storageClassName: longhorn
      resources:
        requests:
          storage: 60Gi
