kind: Deployment
apiVersion: apps/v1
metadata:
  name: nest-aws-iot
  labels:
    name: nest-aws-iot
spec:
  replicas: 1
  selector:
    matchLabels:
      name: nest-aws-iot
  template:
    metadata:
      labels:
        name: nest-aws-iot
      annotations:
        iam.amazonaws.com/role: IoTDataAccess
    spec:
      containers:
        - image: chrisns/nest-aws-iot
          command:
            - sh
            - -c
            - "`wget -qO- https://gist.githubusercontent.com/chrisns/4b732c4b2f85272aef6706d43e7063f8/raw/getiamcreds.js | node` && node index.js"
          name: nest-aws-iot
          imagePullPolicy: Always
          env:
            - name: ACCESS_TOKEN
              valueFrom:
                secretKeyRef:
                  name: nest
                  key: ACCESS_TOKEN
            - name: USER_ID
              valueFrom:
                secretKeyRef:
                  name: nest
                  key: USER_ID
            - name: AWS_IOT_ENDPOINT_HOST
              value: a1o5j7svq7l99k.iot.eu-west-2.amazonaws.com
            - name: AWS_REGION
              value: eu-west-2
          # livenessProbe:
          #   httpGet:
          #     path: /ping
          #     port: 80
          #   initialDelaySeconds: 3
          #   periodSeconds: 3
          #   timeoutSeconds: 1
      # affinity:
      #   podAntiAffinity:
      #     preferredDuringSchedulingIgnoredDuringExecution:
      #     - weight: 100
      #       podAffinityTerm:
      #         labelSelector:
      #           matchExpressions:
      #           - key: role
      #             operator: In
      #             values:
      #             - data
      #         topologyKey: kubernetes.io/hostname
      restartPolicy: Always
