apiVersion: v1
kind: ConfigMap
metadata:
  name: cerebral-simulator-config
  namespace: contoso-hypermarket
data:
  INFLUXDB_URL: "http://influxdb.contoso-hypermarket.svc.cluster.local:8086"
  INFLUXDB_TOKEN: "secret-token"
  INFLUXDB_ORG: "InfluxData"
  INFLUXDB_BUCKET: "hypermarket"
  MQTT_BROKER: "localhost"
  MQTT_PORT: "1883"
  MQTT_TOPIC: "iot/devices"
  REFRIGERATOR_COUNT: "3"
  SCALE_COUNT: "2"
  POS_COUNT: "5"
  SMARTSHELF_COUNT: "3"
  HVAC_COUNT: "3"
  LIGHTINGSYSTEM_COUNT: "3"
  AUTOMATEDCHECKOUT_COUNT: "3"
  EVENTHUB_CONNECTION_STRING: "https://aiohubns021ef.servicebus.windows.net:443/"
  ORDERS_EVENTHUB_NAME: ORDERS
  INVENTORY_EVENTHUB_NAME: INVENTORY
  HISTORICAL_DATA_DAYS: "1"
  ORDER_FREQUENCY: "10"
  PRODUCTS_FILE: "products.json"
  UI_API_URL: "http://backend-api.contoso-hypermarket.svc.cluster.local:5002"
  ENABLE_MQTT: "true"
  ENABLE_INFLUXDB: "true"
  ENABLE_HISTORICAL: "true"
  ENABLE_PROMETHEUS: "true"
  ENABLE_API: "true"
  ENABLE_STORE_SIMULATOR: "true"
  ENABLE_SQL: "true"
  SQL_SERVER: "mssql-service.contoso-hypermarket.svc.cluster.local"
  SQL_DATABASE: "RetailStore"
  SQL_USERNAME: "sa"
  SQL_PASSWORD: "ArcPassword123!!"
  STORE_ID: "SEA"

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cerebral-simulator
  namespace: contoso-hypermarket
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cerebral-simulator
  template:
    metadata:
      labels:
        app: cerebral-simulator
    spec:
      containers:
      - name: cerebral-simulator
        image: mcr.microsoft.com/jumpstart/agora/cerebral_simulator:1.0.0
        envFrom: 
        - configMapRef:
            name: cerebral-simulator-config

---

apiVersion: v1
kind: Service
metadata:
  name: cerebral-simulator-service
  namespace: contoso-hypermarket
  labels:
    app: cerebral-simulator-service
spec:
  type: LoadBalancer
  selector:
    app: cerebral-simulator
  ports:
    - name: cerebral-metrics
      protocol: TCP
      port: 8001
      targetPort: 8001