apiVersion: apps/v1
kind: Deployment
metadata:
  name: florale-emotion-backend
  labels:
    app: florale-emotion-backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: florale-emotion-backend
  template:
    metadata:
      labels:
        app: florale-emotion-backend
    spec:
      # Temporary workaround: ktown can't reach Harbor (ImagePullBackOff).
      # Pin to nuc until node networking to registry is fixed.
      nodeSelector:
        kubernetes.io/hostname: nuc
      imagePullSecrets:
      - name: harbor-registry-secret
      containers:
      - name: florale-emotion-backend
        image: registry.julianvollmer.de/florale-emotion/florale-emotion-backend:__IMAGE_TAG__
        ports:
        - containerPort: 3000
        env:
        - name: NODE_ENV
          value: "production"
        - name: PORT
          value: "3000"
        resources:
          requests:
            memory: "256Mi"
            cpu: "100m"
          limits:
            memory: "512Mi"
            cpu: "300m"
        livenessProbe:
          httpGet:
            path: /api/health
            port: 3000
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /api/health
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: florale-emotion-backend-service
spec:
  selector:
    app: florale-emotion-backend
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
  type: ClusterIP