apiVersion: apps/v1
kind: Deployment
metadata:
  name: hvac-deployment
  labels:
    app: hvac
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hvac
  template:
    metadata:
      labels:
        app: hvac
    spec:
      imagePullSecrets:
        - name: docker-secrets
      containers:
        - name: hvac-container
          image: log680h2022equipe20/lab2:latest
          resources:
            requests:
              memory: "32Mi"
              cpu: "50m"
            limits:
              memory: "128Mi"
              cpu: "150m"
          env:
            - name: HOST
              valueFrom:
                configMapKeyRef:
                  name: hvac-lab
                  key: hvac_host
            - name: MIN_TEMP
              valueFrom:
                configMapKeyRef:
                  name: hvac-lab
                  key: min_temp
            - name: MAX_TEMP
              valueFrom:
                configMapKeyRef:
                  name: hvac-lab
                  key: max_temp
            - name: NB_TICK
              valueFrom:
                configMapKeyRef:
                  name: hvac-lab
                  key: nb_tick
            - name: TOKEN
              valueFrom:
                secretKeyRef:
                  name: hvac-secrets
                  key: hvac_token
                  optional: false
            - name: DB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: hvac-secrets
                  key: db_username
                  optional: false
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: hvac-secrets
                  key: db_password
                  optional: false
            - name: DB_HOST
              valueFrom:
                secretKeyRef:
                  name: hvac-secrets
                  key: db_host
                  optional: false
            - name: DB_NAME
              valueFrom:
                secretKeyRef:
                  name: hvac-secrets
                  key: db_name
                  optional: false