Fix error on deallocation and provides configMap on the helm chart

This commit is contained in:
Alexandre Ferreira
2022-11-03 21:39:05 +00:00
committed by Eric Van Hensbergen
parent 5029c6f4b9
commit 054c2534e1
5 changed files with 69 additions and 6 deletions

View File

@@ -36,6 +36,8 @@ The smarter-device-manager starts by reading a YAML configuration file. This con
nummaxdevices: 10 nummaxdevices: 10
``` ```
If the config value is provided a configMap is generated and smarter-device-manager will use it. The values.yaml file contains two examples, the first is replicated the config that exists on the container and the second enables nitro-enclaves (AWS nitro).
Devices in subdirectories have the slash replaced with underscore in the Devices in subdirectories have the slash replaced with underscore in the
resource name, due to kubernetes naming restrictions: e.g. `/dev/net/tun` resource name, due to kubernetes naming restrictions: e.g. `/dev/net/tun`
becomes `smarter-devices/net_tun`. becomes `smarter-devices/net_tun`.

View File

@@ -40,7 +40,7 @@ spec:
drop: ["ALL"] drop: ["ALL"]
resources: resources:
limits: limits:
cpu: 100m cpu: 200m
memory: 15Mi memory: 15Mi
requests: requests:
cpu: 10m cpu: 10m
@@ -52,6 +52,10 @@ spec:
mountPath: /dev mountPath: /dev
- name: sys-dir - name: sys-dir
mountPath: /sys mountPath: /sys
{{- if .Values.config }}
- name: config
mountPath: /root/config
{{- end }}
volumes: volumes:
- name: device-plugin - name: device-plugin
hostPath: hostPath:
@@ -62,5 +66,9 @@ spec:
- name: sys-dir - name: sys-dir
hostPath: hostPath:
path: /sys path: /sys
{{- if .Values.config }}
- name: config
configMap:
name: {{ .Values.application.appName }}
{{- end }}
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30

View File

@@ -0,0 +1,10 @@
{{- if .Values.config }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.application.appName }}
namespace: {{ .Values.application.namespace }}
data:
conf.yaml: |
{{- toYaml .Values.config | nindent 4 }}
{{- end }}

View File

@@ -6,7 +6,53 @@ application:
image: image:
repository: registry.gitlab.com/smarter-project/smarter-device-manager repository: registry.gitlab.com/smarter-project/smarter-device-manager
#repository: registry.gitlab.com/smarter-project/smarter-device-manager
# @default -- chart.appVersion # @default -- chart.appVersion
tag: "" tag: ""
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# If a specific configurations is used it can be provided by uncommenting this lines
# config:
# - devicematch: ^snd$
# nummaxdevices: 20
# - devicematch: ^gpiomem$
# nummaxdevices: 40
# - devicematch: ^gpiochip[0-9]*$
# nummaxdevices: 20
# - devicematch: ^hci[0-9]*$
# nummaxdevices: 1
# - devicematch: ^i2c-[0-9]*$
# nummaxdevices: 1
# - devicematch: ^rtc0$
# nummaxdevices: 20
# - devicematch: ^video[0-9]*$
# nummaxdevices: 20
# - devicematch: ^vchiq$
# nummaxdevices: 20
# - devicematch: ^vcsm.*$
# nummaxdevices: 20
# - devicematch: ^ttyUSB[0-9]*$
# nummaxdevices: 1
# - devicematch: ^ttyACM[0-9]*$
# nummaxdevices: 1
# - devicematch: ^ttyTHS[0-9]*$
# nummaxdevices: 1
# - devicematch: ^ttyS[0-9]*$
# nummaxdevices: 1
#
# This example of configmap allows nitro enclaves to be allocated in a pod
# config:
# - devicematch: ^nitro_enclaves$
# nummaxdevices: 1
# - devicematch: ^vsock$
# nummaxdevices: 1
# - devicematch: ^rtc0$
# nummaxdevices: 20
# - devicematch: ^ttyUSB[0-9]*$
# nummaxdevices: 1
# - devicematch: ^ttyACM[0-9]*$
# nummaxdevices: 1
# - devicematch: ^ttyTHS[0-9]*$
# nummaxdevices: 1
# - devicematch: ^ttyS[0-9]*$
# nummaxdevices: 1

View File

@@ -69,7 +69,4 @@ spec:
- name: config - name: config
configMap: configMap:
name: smarter-device-manager-rpi name: smarter-device-manager-rpi
- name: config
hostPath:
path: /var/lib/rancher/k3s/agent/kubelet/device-plugins
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30