apiVersion: apps/v1
kind: Deployment
metadata:
  name: iot-data-ingest
  labels:
    app: iot-data-ingest
spec:
  replicas: 1
  selector:
    matchLabels:
      app: iot-data-ingest
  template:
    metadata:
      labels:
        app: iot-data-ingest
      annotations:
        checksum/config: asdf
    spec:
      initContainers:
        - name: migrate-db
          image: dockerhub.kaffi.home:5000/migrate
          env:
            - name: POSTGRES_PASSWORD
              value: tea
              # TODO: Get the password pulled from secrets
          command:
            - sh
            - '-c'
            - |
              set -e
              migrate -source file:///migrations/ -database postgres://postgres:${POSTGRES_PASSWORD}@timescale-timescaledb:5432/kaffi?sslmode=disable up
      containers:
        - name: nginx
          image: nginx:latest
