apiVersion: apps/v1
kind: Deployment
metadata:
  name: dataops-api
  labels:
    app: dataops-api
spec:
  selector:
    matchLabels:
      app: dataops-api
  replicas: 1
  template:
    metadata:
      name: dataops-api
      labels:
        app: dataops-api
    spec:
      containers:
      - name: dataops-api
        image: ojhughes/dataops-api
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 5000
        livenessProbe:
          httpGet:
            port: 5000
            path: /
          initialDelaySeconds: 10
          periodSeconds: 60
        readinessProbe:
          httpGet:
            port: 5000
            path: /
          initialDelaySeconds: 10
          periodSeconds: 60
        env:
        - name: POSTGRES_DB_PSW
          valueFrom:
            # generated by operator into secret {{pg_user_name}}.{{team_id}}.{{pg_cluster_name}}.credentials
            secretKeyRef:
              name: learner-user.dataops-bootcamp-postgresql.credentials.postgresql.acid.zalan.do
              key: password
        - name: POSTGRES_DB_USER
          valueFrom:
            # generated by operator into secret {{pg_user_name}}.{{team_id}}.{{pg_cluster_name}}.credentials
            secretKeyRef:
              name: learner-user.dataops-bootcamp-postgresql.credentials.postgresql.acid.zalan.do
              key: username
      restartPolicy: Always

