apiVersion: apps/v1
kind: Deployment
metadata:
  name: geocrop-api
  namespace: geocrop
spec:
  replicas: 1
  selector:
    matchLabels:
      app: geocrop-api
  template:
    metadata:
      labels:
        app: geocrop-api
    spec:
      containers:
      - name: geocrop-api
        image: frankchine/geocrop-api:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8000
        env:
        - name: REDIS_HOST
          value: "redis.geocrop.svc.cluster.local"
        - name: SECRET_KEY
          value: "portfolio-production-secret-key-123"
        - name: DB_URL
          value: "postgresql://postgres:$(DB_PASSWORD)@geocrop-db:5433/geocrop_gis"
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: geocrop-db-secret
              key: password
---
apiVersion: v1
kind: Service
metadata:
  name: geocrop-api
  namespace: geocrop
spec:
  selector:
    app: geocrop-api
  ports:
  - port: 8000
    targetPort: 8000
