apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-api
  namespace: contoso-hypermarket
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backend-api
  template:
    metadata:
      labels:
        app: backend-api
    spec:
      containers:
      - name: main-ui-backend-api
        image: mcr.microsoft.com/jumpstart/agora/main_ui_backend_api:1.0.0
        ports:
        - containerPort: 5002
        env:
        - name: DATABASE_HOST
          value: "backend-db"
        - name: DATABASE_NAME
          value: "contoso"
        - name: DATABASE_USER
          value: "postgres"
        - name: DATABASE_PASSWORD
          value: "password"
        - name: FLASK_APP
          value: "app.py"
        - name: FLASK_ENV
          value: "development"
        - name: FLASK_RUN_HOST
          value: ""
        - name: MQTT_BROKER
          value: "aio-broker-insecure.azure-iot-operations.svc.cluster.local"
        - name: MQTT_PORT
          value: "1883"
        - name: MQTT_TOPIC
          value: "Store/Cameras/PeopleCount"
        - name: FOOTFALL_API
          value: "http://footfall-ai-api:5000/status"
        - name: SI_API
          value: "http://shopper-insights-api:5001/status"
      imagePullSecrets:
      - name: acr-secret

---

apiVersion: v1
kind: Service
metadata:
  name: backend-api
  namespace: contoso-hypermarket
spec:
  selector:
    app: backend-api
  ports:
    - protocol: TCP
      port: 5002
      targetPort: 5002
  type: LoadBalancer