apiVersion: apps/v1
kind: Deployment
metadata:
  name: reboot-api
spec:
  replicas: 1
  selector:
    matchLabels:
      run: reboot-api
  template:
    metadata:
      labels:
        run: reboot-api
      annotations:
        prometheus.io/scrape: 'true'
    spec:
      containers:
      - name: reboot-api
        image: measurementlab/reboot-api:v0.6.1
        args:
          - "-datastore.project={{GCLOUD_PROJECT}}"
          - "-reboot.key=/var/secrets/reboot-api-ssh.key"
          - "-reboot.bmcport=22"
          - "-auth.username={{REBOOTAPI_USER}}"
          - "-auth.password={{REBOOTAPI_PASS}}"
        volumeMounts:
          - name: credentials
            mountPath: /var/secrets/
        resources:
          limits:
            cpu: 200m
            memory: 200Mi
          requests:
            cpu: 200m
            memory: 50Mi
        ports:
          - containerPort: 9990
      volumes:
        # SSH key to log into CoreOS nodes is provided as a Kubernetes secret.
        - name: credentials
          secret:
            secretName: reboot-api-credentials
      # The Reboot API will only be scheduled onto nodes that we labeled
      # as having a static outbound IP.
      nodeSelector:
        outbound-ip: static
      # We can also taint nodes with static outbound IPs so that services that
      # do not require a static IP aren't scheduled to that node. This
      # deployment, however, will tolerate that taint.
      tolerations:
      - key: "outbound-ip"
        value: "static"
        effect: "NoSchedule"
