From e1d6928821fb0e4e57e1d5345c9d456081fb8d99 Mon Sep 17 00:00:00 2001 From: Eero Tamminen Date: Fri, 26 Aug 2022 19:17:16 +0300 Subject: [PATCH] When changing volume names, controller needs to be changed too Change volume name to a more generic one before the NFD host mount directory itself needs to be changed: https://github.com/kubernetes-sigs/node-feature-discovery/issues/856 Signed-off-by: Eero Tamminen --- pkg/controllers/gpu/controller.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/controllers/gpu/controller.go b/pkg/controllers/gpu/controller.go index ab3878e4e..59187385b 100644 --- a/pkg/controllers/gpu/controller.go +++ b/pkg/controllers/gpu/controller.go @@ -142,7 +142,7 @@ func (c *controller) NewDaemonSet(rawObj client.Object) *apps.DaemonSet { if devicePlugin.Spec.InitImage == "" { daemonSet.Spec.Template.Spec.InitContainers = nil - daemonSet.Spec.Template.Spec.Volumes = removeVolume(daemonSet.Spec.Template.Spec.Volumes, "nfd-source-hooks") + daemonSet.Spec.Template.Spec.Volumes = removeVolume(daemonSet.Spec.Template.Spec.Volumes, "nfd-features") } else { setInitContainer(&daemonSet.Spec.Template.Spec, devicePlugin.Spec.InitImage) } @@ -201,11 +201,11 @@ func setInitContainer(spec *v1.PodSpec, imageName string) { VolumeMounts: []v1.VolumeMount{ { MountPath: "/etc/kubernetes/node-feature-discovery/source.d/", - Name: "nfd-source-hooks", + Name: "nfd-features", }, }, }} - addVolumeIfMissing(spec, "nfd-source-hooks", "/etc/kubernetes/node-feature-discovery/source.d/", v1.HostPathDirectoryOrCreate) + addVolumeIfMissing(spec, "nfd-features", "/etc/kubernetes/node-feature-discovery/source.d/", v1.HostPathDirectoryOrCreate) } func removeVolume(volumes []v1.Volume, name string) []v1.Volume { @@ -243,7 +243,7 @@ func (c *controller) UpdateDaemonSet(rawObj client.Object, ds *apps.DaemonSet) ( if dp.Spec.InitImage == "" { if ds.Spec.Template.Spec.InitContainers != nil { ds.Spec.Template.Spec.InitContainers = nil - ds.Spec.Template.Spec.Volumes = removeVolume(ds.Spec.Template.Spec.Volumes, "nfd-source-hooks") + ds.Spec.Template.Spec.Volumes = removeVolume(ds.Spec.Template.Spec.Volumes, "nfd-features") updated = true } } else {