apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: ggoods-wallet
    version: ${VERSION}
  name: ggoods-wallet
spec:
  serviceName: ggoods-wallet
  replicas: 1
  selector:
    matchLabels:
      app: ggoods-wallet
      version: ${VERSION}
  template:
    metadata:
      labels:
        app: ggoods-wallet
        version: ${VERSION}
    spec:
      imagePullSecrets:
          - name: regcred
      containers:
      - image: ${DOCKER_REGISTRY}/${IMAGE_NAME_WALLET}:${VERSION}
        imagePullPolicy: "Always"
        name: "ggoods-wallet"
        env:
          - name: DATA_DIR
            value: /opt/application/data
          - name: CONFIG_DIR
            value: /opt/application/config
        ports:
        - containerPort: 8888
        volumeMounts:
        - mountPath: /opt/application/data
          subPath: data
          name: data-directory
        - mountPath: /opt/application/config
          name: config-directory
        - mountPath: /opt/application/seeds
          name: wallet-seeds
      restartPolicy: Always
      volumes:
        - name: config-directory
          configMap:
            name: ggoods-wallet-config
        - name: wallet-seeds
          configMap:
            name: wallet-seeds
  volumeClaimTemplates:
    - metadata:
        name: data-directory
      spec:
        accessModes: ["ReadWriteOnce"]
        storageClassName: ggoods-storage
        resources:
          requests:
            storage: 50Gi
