kubernetes-usb-labeler

command module
v0.0.0-...-8ffb1d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

usb-labeler-controller

Quick hack to add labels for each usb device on a node, to help with using affinity to pin nodes to nodes with devices

I don't know enough about usb identifiers nor kubernetes nodes to know if my current implementation is a good plan, but it does work for me

Installation

# This is a configuration example for the node labeller which includes
# ClusterRole and ClusterRoleBinding definitions, as well as the 
# DeamonSet configuration that deploys the actual node labeller
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: usb-labeler
rules:
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["watch", "get", "list", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: labeller
  namespace: default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: usb-labeler
subjects:
- kind: ServiceAccount
  name: default
  namespace: default
- kind: ServiceAccount
  name: default
  namespace: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: usb-labeler
  namespace: kube-system
spec:
  selector:
    matchLabels:
      name: usb-labeler
  template:
    metadata:
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ""
      labels:
        name: usb-labeler
    spec:
      tolerations:
      - key: CriticalAddonsOnly
        operator: Exists
      containers:
      - image: halkeye/usb-labeler-controller:latest
        name: usb-labeler
        env:
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
        securityContext:
          privileged: true #Needed for /dev
          capabilities:
            drop: ["ALL"]
        resources:
          requests:
            memory: "10Mi"
            cpu: "1m"
          limits:
            memory: "128Mi"
            cpu: "500m"
        volumeMounts:
          - name: sys
            mountPath: /sys
          - name: dev
            mountPath: /dev
          - name: etc
            mountPath: /etc
      volumes:
        - name: sys
          hostPath:
            path: /sys
        - name: dev
          hostPath:
            path: /dev
        - name: etc
          hostPath:
            path: /etc

Upgrades

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址