From 2f3dc23651b0da7dbd0c6ff583c0e84ee6d4abba Mon Sep 17 00:00:00 2001 From: Eero Tamminen Date: Thu, 25 Aug 2022 16:59:42 +0300 Subject: [PATCH] Use more generic name for NFD features host directory volume NFD hooks are deprecated and going away: https://github.com/kubernetes-sigs/node-feature-discovery/issues/856 This makes the mount names more future-proof, and shows where later changes need to be done (to change operator mount directory, and switch hook-using deployments e.g. to feature files). Signed-off-by: Eero Tamminen --- deployments/gpu_plugin/base/intel-gpu-plugin.yaml | 4 ++-- .../epc-hook-initcontainer/add-epc-nfd-initcontainer.yaml | 4 ++-- .../overlays/epc-nfd/add-epc-nfd-initcontainer.yaml | 4 ++-- pkg/controllers/gpu/controller.go | 8 ++++---- pkg/controllers/sgx/controller.go | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/deployments/gpu_plugin/base/intel-gpu-plugin.yaml b/deployments/gpu_plugin/base/intel-gpu-plugin.yaml index f793d8457..425479600 100644 --- a/deployments/gpu_plugin/base/intel-gpu-plugin.yaml +++ b/deployments/gpu_plugin/base/intel-gpu-plugin.yaml @@ -24,7 +24,7 @@ spec: allowPrivilegeEscalation: false volumeMounts: - mountPath: /etc/kubernetes/node-feature-discovery/source.d/ - name: nfd-source-hooks + name: nfd-features containers: - name: intel-gpu-plugin env: @@ -58,7 +58,7 @@ spec: - name: kubeletsockets hostPath: path: /var/lib/kubelet/device-plugins - - name: nfd-source-hooks + - name: nfd-features hostPath: path: /etc/kubernetes/node-feature-discovery/source.d/ type: DirectoryOrCreate diff --git a/deployments/sgx_plugin/overlays/epc-hook-initcontainer/add-epc-nfd-initcontainer.yaml b/deployments/sgx_plugin/overlays/epc-hook-initcontainer/add-epc-nfd-initcontainer.yaml index 385dfc0a5..168fa94d4 100644 --- a/deployments/sgx_plugin/overlays/epc-hook-initcontainer/add-epc-nfd-initcontainer.yaml +++ b/deployments/sgx_plugin/overlays/epc-hook-initcontainer/add-epc-nfd-initcontainer.yaml @@ -14,9 +14,9 @@ spec: allowPrivilegeEscalation: false volumeMounts: - mountPath: /etc/kubernetes/node-feature-discovery/source.d/ - name: nfd-source-hooks + name: nfd-features volumes: - - name: nfd-source-hooks + - name: nfd-features hostPath: path: /etc/kubernetes/node-feature-discovery/source.d/ type: DirectoryOrCreate diff --git a/deployments/sgx_plugin/overlays/epc-nfd/add-epc-nfd-initcontainer.yaml b/deployments/sgx_plugin/overlays/epc-nfd/add-epc-nfd-initcontainer.yaml index 385dfc0a5..168fa94d4 100644 --- a/deployments/sgx_plugin/overlays/epc-nfd/add-epc-nfd-initcontainer.yaml +++ b/deployments/sgx_plugin/overlays/epc-nfd/add-epc-nfd-initcontainer.yaml @@ -14,9 +14,9 @@ spec: allowPrivilegeEscalation: false volumeMounts: - mountPath: /etc/kubernetes/node-feature-discovery/source.d/ - name: nfd-source-hooks + name: nfd-features volumes: - - name: nfd-source-hooks + - name: nfd-features hostPath: path: /etc/kubernetes/node-feature-discovery/source.d/ type: DirectoryOrCreate diff --git a/pkg/controllers/gpu/controller.go b/pkg/controllers/gpu/controller.go index 54705d6b4..79c59b3e3 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) } @@ -204,11 +204,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 { @@ -246,7 +246,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 { diff --git a/pkg/controllers/sgx/controller.go b/pkg/controllers/sgx/controller.go index 369da3a9c..ce3084159 100644 --- a/pkg/controllers/sgx/controller.go +++ b/pkg/controllers/sgx/controller.go @@ -114,11 +114,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 (c *controller) NewDaemonSet(rawObj client.Object) *apps.DaemonSet { @@ -165,7 +165,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 {