Skip to content

Commit 054c253

Browse files
alexandref75ericvh
authored andcommitted
Fix error on deallocation and provides configMap on the helm chart
1 parent 5029c6f commit 054c253

File tree

5 files changed

+69
-6
lines changed

5 files changed

+69
-6
lines changed

chart/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ The smarter-device-manager starts by reading a YAML configuration file. This con
3636
nummaxdevices: 10
3737
```
3838

39+
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).
40+
3941
Devices in subdirectories have the slash replaced with underscore in the
4042
resource name, due to kubernetes naming restrictions: e.g. `/dev/net/tun`
4143
becomes `smarter-devices/net_tun`.

chart/templates/common.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
drop: ["ALL"]
4141
resources:
4242
limits:
43-
cpu: 100m
43+
cpu: 200m
4444
memory: 15Mi
4545
requests:
4646
cpu: 10m
@@ -52,6 +52,10 @@ spec:
5252
mountPath: /dev
5353
- name: sys-dir
5454
mountPath: /sys
55+
{{- if .Values.config }}
56+
- name: config
57+
mountPath: /root/config
58+
{{- end }}
5559
volumes:
5660
- name: device-plugin
5761
hostPath:
@@ -62,5 +66,9 @@ spec:
6266
- name: sys-dir
6367
hostPath:
6468
path: /sys
69+
{{- if .Values.config }}
70+
- name: config
71+
configMap:
72+
name: {{ .Values.application.appName }}
73+
{{- end }}
6574
terminationGracePeriodSeconds: 30
66-

chart/templates/configmap.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if .Values.config }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ .Values.application.appName }}
6+
namespace: {{ .Values.application.namespace }}
7+
data:
8+
conf.yaml: |
9+
{{- toYaml .Values.config | nindent 4 }}
10+
{{- end }}

chart/values.yaml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,53 @@ application:
66

77
image:
88
repository: registry.gitlab.com/smarter-project/smarter-device-manager
9-
#repository: registry.gitlab.com/smarter-project/smarter-device-manager
109
# @default -- chart.appVersion
1110
tag: ""
1211
pullPolicy: IfNotPresent
12+
13+
# If a specific configurations is used it can be provided by uncommenting this lines
14+
# config:
15+
# - devicematch: ^snd$
16+
# nummaxdevices: 20
17+
# - devicematch: ^gpiomem$
18+
# nummaxdevices: 40
19+
# - devicematch: ^gpiochip[0-9]*$
20+
# nummaxdevices: 20
21+
# - devicematch: ^hci[0-9]*$
22+
# nummaxdevices: 1
23+
# - devicematch: ^i2c-[0-9]*$
24+
# nummaxdevices: 1
25+
# - devicematch: ^rtc0$
26+
# nummaxdevices: 20
27+
# - devicematch: ^video[0-9]*$
28+
# nummaxdevices: 20
29+
# - devicematch: ^vchiq$
30+
# nummaxdevices: 20
31+
# - devicematch: ^vcsm.*$
32+
# nummaxdevices: 20
33+
# - devicematch: ^ttyUSB[0-9]*$
34+
# nummaxdevices: 1
35+
# - devicematch: ^ttyACM[0-9]*$
36+
# nummaxdevices: 1
37+
# - devicematch: ^ttyTHS[0-9]*$
38+
# nummaxdevices: 1
39+
# - devicematch: ^ttyS[0-9]*$
40+
# nummaxdevices: 1
41+
#
42+
43+
# This example of configmap allows nitro enclaves to be allocated in a pod
44+
# config:
45+
# - devicematch: ^nitro_enclaves$
46+
# nummaxdevices: 1
47+
# - devicematch: ^vsock$
48+
# nummaxdevices: 1
49+
# - devicematch: ^rtc0$
50+
# nummaxdevices: 20
51+
# - devicematch: ^ttyUSB[0-9]*$
52+
# nummaxdevices: 1
53+
# - devicematch: ^ttyACM[0-9]*$
54+
# nummaxdevices: 1
55+
# - devicematch: ^ttyTHS[0-9]*$
56+
# nummaxdevices: 1
57+
# - devicematch: ^ttyS[0-9]*$
58+
# nummaxdevices: 1

smarter-device-manager-ds-with-configmap-rpi-k3s.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,4 @@ spec:
6969
- name: config
7070
configMap:
7171
name: smarter-device-manager-rpi
72-
- name: config
73-
hostPath:
74-
path: /var/lib/rancher/k3s/agent/kubelet/device-plugins
7572
terminationGracePeriodSeconds: 30

0 commit comments

Comments
 (0)