Skip to content

Commit

Permalink
fix(agent): fix issue on the extraVolume mount for the init container (
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo authored Jul 17, 2024
1 parent dfc1725 commit 4aa59d0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 24 deletions.
2 changes: 1 addition & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ sources:
- https://app.sysdigcloud.com/#/settings/user
- https://github.com/draios/sysdig
type: application
version: 1.27.7
version: 1.27.8
8 changes: 4 additions & 4 deletions charts/agent/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ spec:
name: bpf-probes
{{- end }}

{{- if and (.Values.kmodule) (.Values.kmodule.extraVolumes) (.Values.kmodule.extraVolumes.mounts) }}
{{ toYaml .Values.kmodule.extraVolumes.mounts | nindent 12 }}
{{- if .Values.daemonset.kmodule.extraVolumes.mounts }}
{{ toYaml .Values.daemonset.kmodule.extraVolumes.mounts | nindent 12 }}
{{- end }}
{{- end }}
containers:
Expand Down Expand Up @@ -521,8 +521,8 @@ spec:
{{ toYaml .Values.extraVolumes.volumes | nindent 8 }}
{{- end }}

{{- if and (.Values.kmodule) (.Values.kmodule.extraVolumes) (.Values.kmodule.extraVolumes.volumes) }}
{{ toYaml .Values.kmodule.extraVolumes.volumes | nindent 8 }}
{{- if .Values.daemonset.kmodule.extraVolumes.volumes }}
{{ toYaml .Values.daemonset.kmodule.extraVolumes.volumes | nindent 8 }}
{{- end }}
updateStrategy:
type: {{ .Values.daemonset.updateStrategy.type }}
Expand Down
63 changes: 44 additions & 19 deletions charts/agent/tests/volumes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,26 +265,51 @@ tests:

- it: Check kmodule extra volumes/mounts
set:
kmodule:
extraVolumes:
mounts:
- mountPath: /host/usr/lib64
name: lib64-vol
volumes:
- name: lib64-vol
hostPath:
path: /lib64
daemonset:
kmodule:
extraVolumes:
mounts:
- mountPath: /host/usr/lib64
name: lib64-vol
- mountPath: /host/custom
name: custom-vol
volumes:
- name: lib64-vol
hostPath:
path: /lib64
- name: custom-vol
hostPath:
path: /mnt/custom
asserts:
- contains:
path: spec.template.spec.initContainers[0].volumeMounts
content:
mountPath: /host/usr/lib64
name: lib64-vol
- contains:
path: spec.template.spec.volumes
content:
name: lib64-vol
- equal:
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name == "lib64-vol")].mountPath
value: /host/usr/lib64
- equal:
path: spec.template.spec.volumes[?(@.name == "lib64-vol")].hostPath
value:
path: /lib64
- equal:
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name == "custom-vol")].mountPath
value: /host/custom
- equal:
path: spec.template.spec.volumes[?(@.name == "custom-vol")].hostPath
value:
path: /mnt/custom
templates:
- templates/daemonset.yaml

- it: Check kmodule don't have extra volumes/mounts when we set the extraVolumes
set:
extraVolumes:
mounts:
- mountPath: /host/custom
name: custom-vol
volumes:
- name: custom-vol
hostPath:
path: /lib64
path: /mnt/custom
asserts:
- isNull:
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name == "custom-vol")]
templates:
- templates/daemonset.yaml

0 comments on commit 4aa59d0

Please sign in to comment.