apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: sm
  labels:
    group: nuodb
    subgroup: storage
spec:
  serviceName: sm
  replicas: 1
  selector:
    matchLabels:
      nodetype: sm
      app: sm-a
      group: nuodb
  podManagementPolicy: Parallel
  template:
    metadata:
      labels:
        nodetype: sm
        app: sm-a
        group: nuodb
        subgroup: storage
    spec:
      securityContext:
        runAsUser: 0
        fsGroup: 0
      containers:
      - name: sm
        image: nuodb/nuodb-ce:latest
        imagePullPolicy: IfNotPresent
        args: [ "nuosm", "--servers-ready-timeout", "300" ]
        env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - { name: DB_NAME, value: "nuodb"}
        - { name: DB_USER, value: "dba"}
        - { name: DB_PASSWORD, value: "goalie"}
        - { name: NUOCMD_API_SERVER,   value: "admin.nuodbcstor.svc:8888"}
        - { name: PEER_ADDRESS,        value: "admin.nuodbcstor.svc" }
        - { name: NUODB_OPTIONS,       value: "mem 1g" }
        ports:
        - containerPort: 48006
          protocol: TCP
        resources:
          requests:
            memory: "1Gi"
            cpu: "0.5"
        volumeMounts:
        - mountPath: /var/opt/nuodb/archive
          name: archive-volume
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      # volumes:
      # - name: archive-volume
      #   emptyDir: {}
  volumeClaimTemplates:
  - metadata:
      name: archive-volume
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: testsc
      resources:
        requests:
          storage: 20G

