Skip to content

Commit e8480b2

Browse files
Support extra volumes and mounts in the Helm chart
1 parent afef014 commit e8480b2

5 files changed

Lines changed: 79 additions & 0 deletions

File tree

deployments/helm/dranet/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ The following table lists the configurable parameters and their default values:
3232
| `resources.limits.cpu` | CPU resource limit | `""` (not set) |
3333
| `resources.limits.memory` | Memory resource limit | `""` (not set) |
3434
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
35+
| `extraVolumes` | Extra volumes, added after the built-in volumes | `[]` |
36+
| `extraVolumeMounts` | Extra volume mounts for the dranet container, added after the built-in mounts | `[]` |
3537
| `args.filter` | CEL expression to filter network interface attributes | see binary default |
3638
| `args.dbPath` | Persistent bbolt database path; set to `""` to use in-memory state | binary default: `/var/run/dranet/dranet.db` |
3739
| `args.inventoryMinPollInterval` | Minimum interval between two consecutive inventory polls | binary default: `2s` |
@@ -57,6 +59,23 @@ After the upgrade, restart those workloads.
5759
When `args.profileProvider` or `args.cloudProviderHint` is `webhook`, set
5860
`args.webhookURL` to the webhook endpoint.
5961

62+
`extraVolumes` and `extraVolumeMounts` add entries after the built-in volumes
63+
and container mounts. The chart does not change the entries. Do not reuse the
64+
built-in volume names. Example, a host configuration directory mounted
65+
read-only:
66+
67+
```yaml
68+
extraVolumes:
69+
- name: host-config
70+
hostPath:
71+
path: /etc/host-config
72+
type: DirectoryOrCreate
73+
extraVolumeMounts:
74+
- name: host-config
75+
mountPath: /etc/host-config
76+
readOnly: true
77+
```
78+
6079
Parameters can be set at install time using `--set` or a custom values file:
6180

6281
```sh

deployments/helm/dranet/templates/daemonset.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ spec:
127127
mountPropagation: HostToContainer
128128
- name: dranet-run
129129
mountPath: /var/run/dranet
130+
{{- with .Values.extraVolumeMounts }}
131+
{{- toYaml . | nindent 12 }}
132+
{{- end }}
130133
volumes:
131134
- name: device-plugin
132135
hostPath:
@@ -150,3 +153,6 @@ spec:
150153
hostPath:
151154
path: /var/run/dranet
152155
type: DirectoryOrCreate
156+
{{- with .Values.extraVolumes }}
157+
{{- toYaml . | nindent 8 }}
158+
{{- end }}

deployments/helm/dranet/values.schema.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,36 @@
156156
}
157157
]
158158
},
159+
"extraVolumes": {
160+
"type": "array",
161+
"items": {
162+
"type": "object",
163+
"properties": {
164+
"name": {
165+
"type": "string",
166+
"minLength": 1
167+
}
168+
},
169+
"required": ["name"]
170+
}
171+
},
172+
"extraVolumeMounts": {
173+
"type": "array",
174+
"items": {
175+
"type": "object",
176+
"properties": {
177+
"name": {
178+
"type": "string",
179+
"minLength": 1
180+
},
181+
"mountPath": {
182+
"type": "string",
183+
"minLength": 1
184+
}
185+
},
186+
"required": ["name", "mountPath"]
187+
}
188+
},
159189
"nodeSelector": {
160190
"type": "object"
161191
},

deployments/helm/dranet/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ args: {}
4040
# kubelet --root-dir on clusters that relocate it; the default suits a standard kubelet.
4141
kubeletRootDir: /var/lib/kubelet
4242

43+
# Extra volumes and volume mounts for the dranet container.
44+
# The chart adds them after the built-in ones without changes.
45+
# Do not reuse the built-in volume names.
46+
extraVolumes: []
47+
# - name: host-config
48+
# hostPath:
49+
# path: /etc/host-config
50+
# type: DirectoryOrCreate
51+
extraVolumeMounts: []
52+
# - name: host-config
53+
# mountPath: /etc/host-config
54+
# readOnly: true
55+
4356
nodeSelector: {}
4457

4558
affinity: {}

install.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ spec:
155155
mountPropagation: HostToContainer
156156
- name: dranet-run
157157
mountPath: /var/run/dranet
158+
# Additional host mounts go here. Example, a host configuration
159+
# directory mounted read-only (pair with the volume below):
160+
# - name: host-config
161+
# mountPath: /etc/host-config
162+
# readOnly: true
158163
volumes:
159164
- name: device-plugin
160165
hostPath:
@@ -178,4 +183,10 @@ spec:
178183
hostPath:
179184
path: /var/run/dranet
180185
type: DirectoryOrCreate
186+
# Additional host volumes go here. Example, a host configuration
187+
# directory (pair with the mount above):
188+
# - name: host-config
189+
# hostPath:
190+
# path: /etc/host-config
191+
# type: DirectoryOrCreate
181192
---

0 commit comments

Comments
 (0)