Skip to content

Commit

Permalink
Merge pull request #1327 from eero-t/nfd-features
Browse files Browse the repository at this point in the history
Use more generic name for NFD features host directory volume
  • Loading branch information
mythi authored Feb 13, 2023
2 parents e8a7d9f + 2f3dc23 commit f559d87
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions deployments/gpu_plugin/base/intel-gpu-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions pkg/controllers/gpu/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/sgx/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f559d87

Please sign in to comment.