apiVersion: apps/v1
kind: Deployment
metadata:
  name: brcc-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: brcc
      module: brcc-server
  template:
    metadata:
      annotations:
        linkerd.io/inject: enabled
      labels:
        app: brcc
        module: brcc-server
    spec:
      containers:
        - name: brcc-server
          image: fkzhao/brcc-server:v1.0.0
          imagePullPolicy: IfNotPresent
          env:
            - name: SERVER_PORT
              valueFrom:
                configMapKeyRef:
                  key: server_port
                  name: brcc-config
            - name: REDIS_HOST
              valueFrom:
                configMapKeyRef:
                  key: redis_host
                  name: brcc-config
            - name: REDIS_PORT
              valueFrom:
                configMapKeyRef:
                  key: redis_port
                  name: brcc-config
            - name: REDIS_PASSWORD
              valueFrom:
                configMapKeyRef:
                  key: redis_password
                  name: brcc-config
            - name: DB_HOST
              valueFrom:
                configMapKeyRef:
                  key: mysql_host
                  name: brcc-config
            - name: DB_PORT
              valueFrom:
                configMapKeyRef:
                  key: mysql_port
                  name: brcc-config
            - name: DB_USERNAME
              valueFrom:
                configMapKeyRef:
                  key: mysql_username
                  name: brcc-config
            - name: DB_PASSWORD
              valueFrom:
                configMapKeyRef:
                  key: mysql_password
                  name: brcc-config
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 25
            periodSeconds: 20
            successThreshold: 1
            tcpSocket:
              port: 8080
            timeoutSeconds: 1
          ports:
            - containerPort: 8080
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 15
            periodSeconds: 10
            successThreshold: 1
            tcpSocket:
              port: 8080
            timeoutSeconds: 1
      imagePullSecrets:
        - name: regcred
      volumes:
        - configMap:
            name: brcc-config
          name: brcc-config
