apiVersion: apps/v1
kind: Deployment
metadata:
  name: csearch.scraper
  namespace: postgres-operator
spec:
  selector:
    matchLabels:
      app: csearch.scraper
  replicas: 1
  template:
    metadata:
      labels:
        app: csearch.scraper
    spec:
      containers:
        - name: csearch-scraper
          image: scraper:latest
          imagePullPolicy: IfNotPresent
          env:
          - name: DB_VENDOR
            value: "postgres"

          - name: DB_ADDR
            valueFrom: { secretKeyRef: { name: csearch-db-pguser-csearch-db, key: host } }
          - name: DB_URI
            valueFrom: { secretKeyRef: { name: csearch-db-pguser-csearch-db, key: uri } }
          - name: DB_PORT
            valueFrom: { secretKeyRef: { name: csearch-db-pguser-csearch-db, key: port } }
          - name: DB_DATABASE
            valueFrom: { secretKeyRef: { name: csearch-db-pguser-csearch-db, key: dbname } }
          - name: DB_USER
            valueFrom: { secretKeyRef: { name: csearch-db-pguser-csearch-db, key: user } }
          - name: DB_PASSWORD
            valueFrom: { secretKeyRef: { name: csearch-db-pguser-csearch-db, key: password } }
          volumeMounts:
            - name: csearch-storage
              mountPath: "/congress"
          resources:
              requests:
                memory: "256Mi"
                cpu: "500m"
              limits:
                memory: "512Mi"
                cpu: "2000m"
      volumes:
        - name: csearch-storage
          hostPath:
            path: "/Users/sanjee/IdeaProjects/congress_api/scraper/congress"