apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth
spec:
  replicas: 1
  selector:
    matchLabels:
      service: auth
  template:
    metadata:
      labels:
        service: auth
    spec:
      serviceAccountName: barretthousen-service
      containers:
        - name: auth
          image: barretthousen/service-auth:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 5001
              name: grpc
          command:
            - /opt/auth
          args:
            - -migrate
          resources:
            limits:
              cpu: "250m"
              memory: "128Mi"
          volumeMounts:
            - mountPath: /config/
              name: auth-config
      volumes:
        - name: auth-config
          secret:
            secretName: auth-config
---
apiVersion: v1
kind: Service
metadata:
  name: auth
spec:
  selector:
    service: auth
  ports:
    - port: 5001
      targetPort: 5001
      name: grpc
---
apiVersion: v1
kind: Secret
metadata:
  name: auth-config
stringData:
  config.yaml: |
    log_level: 2
    port: 5001
    db_service:
        scheme: postgres
        port: 5432
        host: bh-db
        name: bh
        user: auth-service
        password: auth-service
    db_migrate:
        scheme: postgres
        port: 5432
        host: bh-db
        name: bh
        user: postgres
        password: bh-admin
