# An example of a Kubernetes configuration for pod deployment.
apiVersion: apps/v1
kind: StatefulSet
metadata:
  # Cluster name.
  name: ignite-cluster
  namespace: ignite-namespace
spec:
  # The initial number of Ignite pods.
  replicas: 2
  serviceName: ignite-service
  selector:
    matchLabels:
      app: ignite
  template:
    metadata:
      labels:
        app: ignite
    spec:
      serviceAccountName: ignite
      # terminationGracePeriodSeconds: 60000 (use in production for graceful restarts and shutdowns)
      containers:
        # Custom pod name.
        - name: ignite-node
          image: gridgain/ultimate:8.8.18
          env:
            - name: OPTION_LIBS
              value: ignite-kubernetes,ignite-rest-http,control-center-agent
            - name: CONFIG_URI
              value: file:///ignite/config/ignite-node-cfg.xml
            - name: JVM_OPTS
              value: "-DIGNITE_WAL_MMAP=false"
              # consider this property for production -DIGNITE_WAIT_FOR_BACKUPS_ON_SHUTDOWN=true
          ports:
            # Ports you might need to open.
            - containerPort: 47100 # communication SPI port
            - containerPort: 47500 # discovery SPI port
            - containerPort: 49112 # JMX port
            - containerPort: 10800 # thin clients/JDBC driver port
            - containerPort: 8080 # REST API
          volumeMounts:
            - mountPath: /ignite/config
              name: config-vol
            - mountPath: /ignite/work
              name: work-vol
            - mountPath: /ignite/storage
              name: storage-vol
            - mountPath: /ignite/wal
              name: wal-vol
            - mountPath: /ignite/walarchive
              name: walarchive-vol
      volumes:
        - name: config-vol
          configMap:
            name: ignite-cfg-persistent
  volumeClaimTemplates:
    - metadata:
        name: work-vol
      spec:
        # the volume can be mounted as read-write by a single node and shared by all pods on this node.
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: "1Gi" # make sure to provide enough space for your application data

    - metadata:
        name: storage-vol
      spec:
        accessModes: [ "ReadWriteOnce" ]
        #storageClassName: "ignite-fast-storage-class"
        resources:
          requests:
            storage: "1Gi"

    - metadata:
        name: wal-vol
      spec:
        accessModes: [ "ReadWriteOnce" ]
        #storageClassName: "ignite-wal-storage-class"
        resources:
          requests:
            storage: "1Gi"

    - metadata:
        name: walarchive-vol
      spec:
        accessModes: [ "ReadWriteOnce" ]
        #storageClassName: "ignite-walarchive-storage-class"
        resources:
          requests:
            storage: "1Gi"
