apiVersion: apps/v1
kind: Deployment
metadata:
  name: "replenishments"
  namespace: "{{ .Values.infrastructure.namespace }}"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: "replenishments"
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: "replenishments"
    spec:
      containers:
      - image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
        name: "{{ .Values.infrastructure.appName }}"
        resources:
          requests:
            memory: "{{ .Values.resources.requests.memory }}"
            cpu: "{{ .Values.resources.requests.cpu }}"
          limits:
            memory: "{{ .Values.resources.limits.memory }}"
            cpu: "{{ .Values.resources.limits.cpu }}"
        env:
        - name: SERVICE_NAME
          value: InventoryReplenishmentService
        - name: MYSQL_HOST
          value: "{{ .Values.config.mysql_host }}"
        - name: MYSQL_PORT
          value: "{{ .Values.config.mysql_port }}"
        - name: MYSQL_USER
          value: "{{ .Values.config.mysql_username }}"
        - name: MYSQL_PASS
          value: "{{ .Values.config.mysql_password }}"
        - name: MYSQL_DATABASE
          value: "{{ .Values.config.mysql_database }}"
        - name: MIN_ORDER_INTERVAL_SECONDS
          value: "{{ .Values.config.min_order_interval_seconds }}"
        - name: MAX_ORDER_INTERVAL_SECONDS
          value: "{{ .Values.config.max_order_interval_seconds }}"
        - name: SHIPMENT_INTERVAL_SECONDS
          value: "{{ .Values.config.shipment_interval_seconds }}"
        - name: SHIPMENT_COUNT
          value: "{{ .Values.config.shipment_count }}"
        - name: ORDER_RETURN_INTERVAL_SECONDS
          value: "{{ .Values.config.order_return_interval_seconds }}"
        - name: ORDER_RETURN_AGE_SECONDS
          value: "{{ .Values.config.order_return_age_seconds }}"
        - name: ORDER_RETURN_COUNT
          value: "{{ .Values.config.order_return_count }}"
        - name: REPLENISHMENT_INTERVAL_SECONDS
          value: "{{ .Values.config.replenishment_interval_seconds }}"