apiVersion: apps/v1
kind: Deployment
metadata:
  name: recommender
  namespace: media
spec:
  replicas: 1
  selector:
    matchLabels:
      app: recommender
  template:
    metadata:
      labels:
        app: recommender
    spec:
      containers:
        - name: recommender
          image: git.ivanch.me/ivanch/recommender:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 80
          env:
            - name: OPENAI_API_KEY
              valueFrom:
                secretKeyRef:
                  name: recommender-secrets
                  key: OPENAI_API_KEY
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: recommender-secrets
                  key: DATABASE_URL
          resources:
            requests:
              memory: "256Mi"
              cpu: "500m"
            limits:
              memory: "512Mi"
              cpu: "1"
---
apiVersion: v1
kind: Service
metadata:
  name: recommender
  namespace: media
spec:
  selector:
    app: recommender
  ports:
    - port: 80
      targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: recommender
  namespace: media
  labels:
    app.kubernetes.io/name: recommender
spec:
  ingressClassName: nginx
  rules:
    - host: "recommender.haven"
      http:
        paths:
          - path: "/"
            pathType: Prefix
            backend:
              service:
                name: recommender
                port:
                  number: 80
