apiVersion: apps/v1
kind: Deployment
metadata:
  name: service-info-fetcher
  labels:
    app: service-info-fetcher
    deploymentType: with-init-container
    needs-db: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: service-info-fetcher
  template:
    metadata:
      annotations:
        linkerd.io/inject: enabled
      labels:
        app: service-info-fetcher
    spec:
      containers:
        - name: service-info-fetcher
          image: headless-lms
          command: ["cargo", "run", "--bin", "service_info_fetcher"]
          resources:
            requests:
              memory: 100Mi
              cpu: 20m
            limits:
              memory: 300Mi
              cpu: 200m
          envFrom:
            - secretRef:
                name: headless-lms-secrets
      initContainers:
        - name: headless-lms-wait-for-db
          image: headless-lms
          command:
            - bash
            - "-c"
            - |
              echo Waiting for postgres to be available
              timeout 120 ./wait-for-db.sh
              ./wait-for-db-migrations.sh
          resources:
            requests:
              memory: 100Mi
              cpu: 20m
            limits:
              memory: 300Mi
              cpu: 200m
          envFrom:
            - secretRef:
                name: headless-lms-secrets
