---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tumbo-server
spec:
  selector:
    matchLabels:
      app: tumbo-server
  replicas: 1
  template:
    metadata:
      annotations:
        version: develop
      labels:
        app: tumbo-server
    spec:
      initContainers:
        - name: check-db-ready
          image: postgres:9.6.5
          command: [
              "sh",
              "-c",
              "until pg_isready -h db-service -p 5432;
              do echo waiting for database; sleep 2; done;",
            ]
      containers:
        - name: tumbo-server
          image: philipsahli/go-tumbo:latest
          imagePullPolicy: Never
          ports:
            - containerPort: 8000
          volumeMounts:
            - name: tumbo-config-volume
              mountPath: /etc/tumbo
      volumes:
        - name: tumbo-config-volume
          configMap:
            name: tumbo-config
