generic-device-plugin

by gabe565

Helm chartv0.1.3App latestVerified publisher

The generic-device-plugin enables allocating generic Linux devices, such as serial devices, the FUSE device, or video cameras, to Kubernetes Pods

About this chart

Generic Device Plugin

The generic-device-plugin enables allocating generic Linux devices, such as serial devices, the FUSE device, or video cameras, to Kubernetes Pods

Homepage: https://charts.gabe565.com/charts/generic-device-plugin/

This chart is not maintained by the upstream project and any issues with the chart should be raised here

Source Code

Requirements

Kubernetes: >=1.22.0-0

Dependencies

RepositoryNameVersion
https://bjw-s.github.io/helm-chartscommon1.5.1

Installing the Chart

To install the chart with the release name generic-device-plugin

OCI (Recommended)

helm install generic-device-plugin oci://ghcr.io/gabe565/charts/generic-device-plugin

Traditional

helm repo add gabe565 https://charts.gabe565.com
helm repo update
helm install generic-device-plugin gabe565/generic-device-plugin

Uninstalling the Chart

To uninstall the generic-device-plugin deployment

helm uninstall generic-device-plugin

The command removes all the Kubernetes components associated with the chart including persistent volumes and deletes the release.

Configuration

Read through the values.yaml file. It has several commented out suggested values. Other values may be used from the values.yaml from the bjw-s common library.

Specify each parameter using the --set key=value[,key=value] argument to helm install.

helm install generic-device-plugin \
  --set env.TZ="America/New York" \
    gabe565/generic-device-plugin

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.

helm install generic-device-plugin gabe565/generic-device-plugin -f values.yaml

Custom configuration

Configuring Devices

Generic Device Plugin will only expose whitelisted devices. To add a device with this Helm chart, add it to config.data in the following format:

config:
  data: |
    devices:
      - <device specs>

Device Spec

  • Multiple paths can be given for each type. Paths can be globs.
  • Should be provided in the form:
    name: <name>
    groups:
      - <device definitions>
    count: <count>
    

Device Definition

  • The device definition can be either a path to a device file or a USB device. You cannot define both in the same group.
  • For device files, use something like:
    paths:
      - path: <path-1>
        mountPath: <mount-path-1>
      - path: <path-2>
        mountPath: <mount-path-2>
    
    • For example, to expose serial devices with different names:
      name: serial
      groups:
        - paths:
            - path: /dev/ttyUSB*
        - paths:
            - path: /dev/ttyACM*
      
    • For USB devices, use something like:
      usb:
        - vendor: "1209"
          product: "000F"
      
    • For example, to expose a CH340 serial converter:
      name: ch340
      groups:
        - usb:
            - vendor: "1a86"
              product: "7523"
      
  • The device flag can specify lists of devices that should be grouped and mounted into a container together as one single meta-device.
    • For example, to allocate and mount an audio capture device:
      name: capture
      groups:
        - paths:
            - path: /dev/snd/pcmC0D0c
            - path: /dev/snd/controlC0
      
  • A "count" can be specified to allow a discovered device group to be scheduled multiple times.
    • For example, to permit allocation of the FUSE device 10 times:
      name: fuse
      groups:
        - count: 10
          paths:
            - path: /dev/fuse
      
    • Note: if omitted, "count" is assumed to be 1

See values.yaml for an example configuration file.

Values

Important: When deploying an application Helm chart you can add more values from the bjw-s common library chart here

KeyTypeDefaultDescription
config.datastringSee values.yamlgeneric-device-plugin config file [ref]
config.enabledbooltrueEnables the config file ConfigMap
controller.typestring"daemonset"Sets the controller type
envobjectSee values.yamlEnvironment variables [ref]
env.DOMAINstring"squat.ai"The domain to use when declaring devices
image.pullPolicystring"Always"Image pull policy
image.repositorystring"ghcr.io/squat/generic-device-plugin"Image repository
image.tagstring"latest"Image tag
persistence.devobjectSee values.yamlHost path volume bind to the dev dir
persistence.device-pluginsobjectSee values.yamlHost path volume bind to the Kubelet plugin directory
probes.livenessobject{"path":"/health","type":"HTTP"}Configures liveness probe
probes.readinessobject{"path":"/health","type":"HTTP"}Configures readiness probe
probes.startupobject{"path":"/health","type":"HTTP"}Configures startup probe
securityContext.privilegedbooltruePrivileged mode is required to access devices
service.mainobjectSee values.yamlConfigures health/metrics service settings for the chart.
serviceMonitor.main.enabledboolfalseEnables or disables the serviceMonitor.
serviceMonitor.main.endpointslistSee values.yamlConfigures the endpoints for the serviceMonitor.

Autogenerated from chart metadata using helm-docs

Deploy generic-device-plugin with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has generic-device-plugin on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgeneric-device-plugin is pinned at v0.1.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply