apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: aisproxy
spec:
  selector:
    matchLabels:
       app: aisproxy-app
       primaryproxy: "false"
  serviceName: "aisproxy-app"
  replicas: 1
  template:
    metadata:
      labels:
        app: aisproxy-app
        primaryproxy: "false"
    spec:
      containers:
      - name: aisproxy
        image: ${DOCKER_HOST_IP}:5000/ais:v1
        livenessProbe:
          httpGet:
            path: /v1/health
            port: 8080
          initialDelaySeconds: 20
          periodSeconds: 10
        env:
         - name: AIS_NODE_ROLE
           value: "proxy"
        volumeMounts:
         - name: ais-config
           mountPath: /aisconfig/ais.json
           subPath: ais.json
         - name: collectd-config
           mountPath: /etc/collectd/collectd.conf
           subPath: collectd.conf
         - name: statsd-config
           mountPath: /opt/statsd/statsd.conf
           subPath: statsd.conf
         - name: aws-credentials
           mountPath: /root/.aws/
         - name: ais-log
           mountPath: /tmp/
         - name: ais-localbucket
           mountPath: /usr/nvidia/
        ports:
          - containerPort: 8080
      nodeSelector:
          nodename: ${PROXY_LABEL}
      volumes:
        - name: ais-config
          configMap:
            name: ais-config
        - name: collectd-config
          configMap:
            name: collectd-config
        - name: statsd-config
          configMap:
            name: statsd-config
        - name: aws-credentials
          secret:
            secretName: aws-credentials
        - name: ais-log
          hostPath:
            path: /tmp
            type: Directory
        - name: ais-localbucket
          hostPath:
            path: /usr/nvidia/
            type: Directory
