apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: water-controller
spec:
  selector:
    matchLabels:
      app: water-controller
  serviceName: "water-controller"
  replicas: 1
  template:
    metadata:
      labels:
        app: water-controller
    spec:
      containers:
        - name: water-controller
          image: "docker.io/shanisma/k8s-one-green:latest"
          command: [ '/bin/bash', '-c' ]
          args: [ 'cd water && python node_controller.py' ]
          imagePullPolicy: Always
          env:
            - name: POSTGRES_HOST
              value: "db"
            - name: POSTGRES_PORT
              value: "5432"
            - name: POSTGRES_USER
              value: "postgres"
            - name: POSTGRES_PASSWORD
              value: "postgres"
            - name: POSTGRES_DB
              value: "postgres"
            - name: MQTT_HOST
              value: "mqtt"
            - name: MQTT_PORT
              value: "1883"
            - name: MQTT_USERNAME
              value: "admin"
            - name: MQTT_PASSWORD
              value: "admin"
