apiVersion: apps/v1
kind: Deployment
metadata:
  name: led-blinker
  labels:
    app: led-blinker
spec:
  replicas: 1
  selector:
    matchLabels:
      app: led-blinker
  strategy:
    type: Recreate  # All existing Pods are killed before new ones are created
  template:
    metadata:
      labels:
        app: led-blinker
        version: 0.0.1
    spec:
      nodeSelector:
        gpio: led  # select the node that has the gpio to led
      containers:
      - image: arnulfosolis/py-led-blinker:master
        name: led-blinker
        env:
        - name: PIN_NUMBER
          value: "4"
        ports:
        - containerPort: 5000
          name: led-blinker
        volumeDevices:
        - name: gpio-volume
          devicePath: /dev/gpiomem
        securityContext:
          privileged: true
      restartPolicy: Always
