apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: update-agent-engine-exporter
spec:
  selector:
    matchLabels:
      app: flatcar-linux-ue-exporter
  template:
    metadata:
      labels:
        app: flatcar-linux-ue-exporter
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "26756"
    spec:
      containers:
        - command:
            - /bin/ue-exporter
          env:
            - name: UPDATE_AGENT_NODE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: spec.nodeName
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
          image: ghcr.io/dafnifacility/flatcar-linux-ue-exporter:main
          imagePullPolicy: IfNotPresent
          name: exporter
          resources:
            limits:
              cpu: 100m
              memory: 512Mi
            requests:
              cpu: 100m
              memory: 512Mi
          securityContext:
            runAsUser: 0
            readOnlyRootFilesystem: true
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /var/run/dbus
              name: var-run-dbus
            - mountPath: /etc/flatcar
              name: etc-flatcar
              readOnly: true
            - mountPath: /usr/share/flatcar
              name: usr-share-flatcar
              readOnly: true
            - mountPath: /etc/os-release
              name: etc-os-release
              readOnly: true
          ports:
            - containerPort: 26756
              name: http-prom
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext: {}
      terminationGracePeriodSeconds: 30
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
          operator: Exists
      volumes:
        - hostPath:
            path: /var/run/dbus
            type: ""
          name: var-run-dbus
        - hostPath:
            path: /etc/flatcar
            type: ""
          name: etc-flatcar
        - hostPath:
            path: /usr/share/flatcar
            type: ""
          name: usr-share-flatcar
        - hostPath:
            path: /etc/os-release
            type: ""
          name: etc-os-release
  updateStrategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate
