apiVersion: apps/v1
kind: Deployment
metadata:
  name: gnzserver
spec:
  selector:
    matchLabels:
      app: gnzserver
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  replicas: 2
  template:
    metadata:
      labels:
        app: gnzserver
    spec:
      volumes:
      - name: grantnz-pub-secret
        secret:
          secretName: grantnz-pub-secret
      - name: grantnz-pri-secret
        secret:
          secretName: grantnz-pri-secret
      containers:
      - name: gnzserver
        image: grantnz/gnzserver:latest
        volumeMounts:
        - name: grantnz-pub-secret
          mountPath: "/secret/public_key"
        - name: grantnz-pri-secret
          mountPath: "/secret/private_key"
        env:
        - name: LOG_LEVEL
          value: "info"
        - name: DB_ENGINE
          value: "mysql"
        - name: DB_HOST
          value: "docker.for.mac.localhost"
        - name: DB_USER
          value: "root"
        - name: DB_PORT
          value: "3306"
        - name: DB_NAME
          value: "grant_n_z"
        - name: ETCD_HOST
          value: "docker.for.mac.localhost"
        - name: ETCD_PORT
          value: "2379"
        - name: SERVER_PORT
          value: "8080"
        - name: SERVER_TOKEN_EXPIRE_HOUR
          value: "100"
        - name: SERVER_SIGN_ALGORITHM
          value: "rsa256"
        - name: SERVER_PRIVATE_KEY_PATH
          value: "/secret/private_key/grantnz-private.key"
        - name: SERVER_PUBLIC_KEY_PATH
          value: "/secret/public_key/grantnz-public.key"
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: grantnz-db-secret
              key: rdbms-password
