@@ -37,6 +37,7 @@ import (
3737const (
3838 ownerKey = ".metadata.controller.iaa"
3939 inicontainerName = "intel-iaa-initcontainer"
40+ configVolumeName = "intel-iaa-config-volume"
4041)
4142
4243// +kubebuilder:rbac:groups=deviceplugin.intel.com,resources=iaadeviceplugins,verbs=get;list;watch;create;update;patch;delete
@@ -97,7 +98,7 @@ func removeInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
9798 newVolumes := []v1.Volume {}
9899
99100 for _ , volume := range ds .Spec .Template .Spec .Volumes {
100- if volume .Name == "intel-iaa-config-volume" || volume .Name == "sys-bus-dsa" || volume .Name == "sys-devices" || volume .Name == "scratch" {
101+ if volume .Name == configVolumeName || volume .Name == "sys-bus-dsa" || volume .Name == "sys-devices" || volume .Name == "scratch" {
101102 continue
102103 }
103104
@@ -175,7 +176,7 @@ func addInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin) {
175176
176177 if dp .Spec .ProvisioningConfig != "" {
177178 ds .Spec .Template .Spec .Volumes = append (ds .Spec .Template .Spec .Volumes , v1.Volume {
178- Name : "intel-iaa-config-volume" ,
179+ Name : configVolumeName ,
179180 VolumeSource : v1.VolumeSource {
180181 ConfigMap : & v1.ConfigMapVolumeSource {
181182 LocalObjectReference : v1.LocalObjectReference {Name : dp .Spec .ProvisioningConfig }},
@@ -185,7 +186,7 @@ func addInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin) {
185186 for i , initcontainer := range ds .Spec .Template .Spec .InitContainers {
186187 if initcontainer .Name == inicontainerName {
187188 ds .Spec .Template .Spec .InitContainers [i ].VolumeMounts = append (ds .Spec .Template .Spec .InitContainers [i ].VolumeMounts , v1.VolumeMount {
188- Name : "intel-iaa-config-volume" ,
189+ Name : configVolumeName ,
189190 MountPath : "/idxd-init/conf" ,
190191 })
191192 }
@@ -219,7 +220,7 @@ func provisioningUpdate(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
219220 found := false
220221
221222 for _ , container := range ds .Spec .Template .Spec .InitContainers {
222- if container .Name == "intel-iaa-initcontainer" {
223+ if container .Name == inicontainerName {
223224 if container .Image != dp .Spec .InitImage {
224225 update = true
225226 }
@@ -231,7 +232,7 @@ func provisioningUpdate(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
231232 }
232233
233234 for _ , volume := range ds .Spec .Template .Spec .Volumes {
234- if volume .Name == "intel-iaa-config-volume" && volume .ConfigMap .Name != dp .Spec .ProvisioningConfig {
235+ if volume .Name == configVolumeName && volume .ConfigMap .Name != dp .Spec .ProvisioningConfig {
235236 update = true
236237
237238 break
0 commit comments