---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: hpessa-exporter
  namespace: openshift-storage-hpessa
  labels:
    app.kubernetes.io/name: hpessa-exporter
    app.kubernetes.io/part-of: openshift-storage-hpessa
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: hpessa-exporter
      app.kubernetes.io/part-of: openshift-storage-hpessa
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
        prometheus.io/path: "/metrics"
      labels:
        app.kubernetes.io/name: hpessa-exporter
        app.kubernetes.io/part-of: openshift-storage-hpessa
    spec:
      containers:
        - name: hpessa-exporter
          image: hpessa-exporter:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              name: metrics
              protocol: TCP
          command: ["/bin/hpessa-exporter"]
          args: ["--port=8080"]
          resources:
            requests:
              cpu: 8m
              memory: 32Mi
          terminationMessagePolicy: FallbackToLogsOnError
          securityContext:
            privileged: true
            runAsUser: 0
          volumeMounts:
            - mountPath: /host/sys
              mountPropagation: HostToContainer
              name: sys
              readOnly: true
            - mountPath: /host/dev
              mountPropagation: HostToContainer
              name: dev
              readOnly: true
          env:
            - name: HOST_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
      nodeSelector:
        kubernetes.io/os: linux
      serviceAccountName: hpessa-exporter
      tolerations:
        - operator: Exists
      volumes:
        - hostPath:
            path: /sys
          name: sys
        - hostPath:
            path: /dev
          name: dev
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 10%
    type: RollingUpdate
