---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: apt-version-exporter
    app.kubernetes.io/instance: apt-version-exporter
    app.kubernetes.io/name: apt-version-exporter
  name: apt-version-exporter
  namespace: apt-version-exporter
spec:
  selector:
    matchLabels:
      app: apt-version-exporter
  template:
    metadata:
      labels:
        app: apt-version-exporter
        app.kubernetes.io/instance: apt-version-exporter
        app.kubernetes.io/name: apt-version-exporter
    spec:
      containers:
      - env:
        - name: AVE_INTERVAL
          value: 2h
        - name: AVE_ADDRESS
          value: ":9191"
        image: git.ar21.de/yolokube/go-apt-version-exporter:latest
        imagePullPolicy: IfNotPresent
        name: apt-version-exporter
        ports:
        - containerPort: 9191
          name: http-metrics
          protocol: TCP
        resources:
          limits:
            cpu: 300m
            memory: 128Mi
          requests:
            cpu: 200m
            memory: 32Mi
        volumeMounts:
        - mountPath: /var/lib/dpkg
          name: var-lib-dpkg
          readOnly: true
        - mountPath: /var/lib/apt
          name: var-lib-apt
          readOnly: false
        - mountPath: /etc/apt
          name: etc-apt
          readOnly: true
        - mountPath: /etc/ssl/certs
          name: etc-ssl-certs
          readOnly: true
        - mountPath: /usr/share/ca-certificates
          name: usr-share-ca-certificates
          readOnly: true
        - mountPath: /etc/ca-certificates.conf
          name: etc-ca-certificates-conf
          readOnly: true
      initContainers:
      - name: get-architecture
        image: debian:12.9
        imagePullPolicy: IfNotPresent
        command: [
          "sh", "-c",
          "dpkg --print-architecture > /var/lib/dpkg/arch"
        ]
        volumeMounts:
        - mountPath: /var/lib/dpkg
          name: var-lib-dpkg
          readOnly: false
      serviceAccountName: apt-version-exporter-service-account
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
        operator: Exists
      - effect: NoSchedule
        key: node-role.kubernetes.io/control-plane
        operator: Exists
      volumes:
      - hostPath:
          path: /var/lib/dpkg
        name: var-lib-dpkg
      - hostPath:
          path: /var/lib/apt
        name: var-lib-apt
      - hostPath:
          path: /etc/apt
        name: etc-apt
      - hostPath:
          path: /etc/ssl/certs
        name: etc-ssl-certs
      - hostPath:
          path: /usr/share/ca-certificates
        name: usr-share-ca-certificates
      - hostPath:
          path: /etc/ca-certificates.conf
        name: etc-ca-certificates-conf