apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-feature-discovery-worker
  namespace: node-feature-discovery
  labels:
    helm.sh/chart: node-feature-discovery-0.18.3
    app.kubernetes.io/name: node-feature-discovery
    app.kubernetes.io/instance: node-feature-discovery
    app.kubernetes.io/version: "v0.18.3"
    app.kubernetes.io/managed-by: Helm
    role: worker
spec:
  revisionHistoryLimit:
  selector:
    matchLabels:
      app.kubernetes.io/name: node-feature-discovery
      app.kubernetes.io/instance: node-feature-discovery
      role: worker
  template:
    metadata:
      labels:
        app.kubernetes.io/name: node-feature-discovery
        app.kubernetes.io/instance: node-feature-discovery
        role: worker
      annotations:
        checksum/config: 0ff3ad6ed18d5d7f9cd6e7d703e20338b50f37fe59fddf7cf6a5a57525292ed8
    spec:
      dnsPolicy: ClusterFirstWithHostNet
      imagePullSecrets:
      serviceAccountName: node-feature-discovery-worker
      securityContext: {}
      hostNetwork: false
      containers:
        - name: worker
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
          image: "registry.k8s.io/nfd/node-feature-discovery:v0.18.3"
          imagePullPolicy: IfNotPresent
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 10
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 5
            failureThreshold: 10
          env:
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_UID
              valueFrom:
                fieldRef:
                  fieldPath: metadata.uid
          resources:
            limits:
              memory: 512Mi
            requests:
              cpu: 20m
              memory: 60Mi
          command:
            - "nfd-worker"
          args:
            - "-feature-gates=NodeFeatureGroupAPI=true"
            - "-port=8080"
          ports:
            - containerPort: 8080
              name: http
          volumeMounts:
            - name: host-boot
              mountPath: "/host-boot"
              readOnly: true
            - name: host-os-release
              mountPath: "/host-etc/os-release"
              readOnly: true
            - name: host-sys
              mountPath: "/host-sys"
              readOnly: true
            - name: host-usr-lib
              mountPath: "/host-usr/lib"
              readOnly: true
            - name: host-lib
              mountPath: "/host-lib"
              readOnly: true
            - name: host-proc-swaps
              mountPath: "/host-proc/swaps"
              readOnly: true
            - name: features-d
              mountPath: "/etc/kubernetes/node-feature-discovery/features.d/"
              readOnly: true
            - name: nfd-worker-conf
              mountPath: "/etc/kubernetes/node-feature-discovery"
              readOnly: true
      volumes:
        - name: host-boot
          hostPath:
            path: "/boot"
        - name: host-os-release
          hostPath:
            path: "/etc/os-release"
        - name: host-sys
          hostPath:
            path: "/sys"
        - name: host-usr-lib
          hostPath:
            path: "/usr/lib"
        - name: host-lib
          hostPath:
            path: "/lib"
        - name: host-proc-swaps
          hostPath:
            path: "/proc/swaps"
        - name: features-d
          hostPath:
            path: "/etc/kubernetes/node-feature-discovery/features.d/"
        - name: nfd-worker-conf
          configMap:
            name: node-feature-discovery-worker-conf
            items:
              - key: nfd-worker.conf
                path: nfd-worker.conf
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/control-plane
          operator: Exists
