@@ -35,8 +35,9 @@ import (
35
35
)
36
36
37
37
const (
38
- ownerKey = ".metadata.controller.iaa"
39
- inicontainerName = "intel-iaa-initcontainer"
38
+ ownerKey = ".metadata.controller.iaa"
39
+ initcontainerName = "intel-iaa-initcontainer"
40
+ configVolumeName = "intel-iaa-config-volume"
40
41
)
41
42
42
43
// +kubebuilder:rbac:groups=deviceplugin.intel.com,resources=iaadeviceplugins,verbs=get;list;watch;create;update;patch;delete
@@ -85,7 +86,7 @@ func removeInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
85
86
newInitContainers := []v1.Container {}
86
87
87
88
for _ , container := range ds .Spec .Template .Spec .InitContainers {
88
- if container .Name == inicontainerName {
89
+ if container .Name == initcontainerName {
89
90
continue
90
91
}
91
92
@@ -97,7 +98,7 @@ func removeInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
97
98
newVolumes := []v1.Volume {}
98
99
99
100
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" {
101
102
continue
102
103
}
103
104
@@ -113,7 +114,7 @@ func addInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin) {
113
114
ds .Spec .Template .Spec .InitContainers = append (ds .Spec .Template .Spec .InitContainers , v1.Container {
114
115
Image : dp .Spec .InitImage ,
115
116
ImagePullPolicy : "IfNotPresent" ,
116
- Name : inicontainerName ,
117
+ Name : initcontainerName ,
117
118
Env : []v1.EnvVar {
118
119
{
119
120
Name : "NODE_NAME" ,
@@ -175,17 +176,17 @@ func addInitContainer(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin) {
175
176
176
177
if dp .Spec .ProvisioningConfig != "" {
177
178
ds .Spec .Template .Spec .Volumes = append (ds .Spec .Template .Spec .Volumes , v1.Volume {
178
- Name : "intel-iaa-config-volume" ,
179
+ Name : configVolumeName ,
179
180
VolumeSource : v1.VolumeSource {
180
181
ConfigMap : & v1.ConfigMapVolumeSource {
181
182
LocalObjectReference : v1.LocalObjectReference {Name : dp .Spec .ProvisioningConfig }},
182
183
},
183
184
})
184
185
185
186
for i , initcontainer := range ds .Spec .Template .Spec .InitContainers {
186
- if initcontainer .Name == inicontainerName {
187
+ if initcontainer .Name == initcontainerName {
187
188
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 ,
189
190
MountPath : "/idxd-init/conf" ,
190
191
})
191
192
}
@@ -219,7 +220,7 @@ func provisioningUpdate(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
219
220
found := false
220
221
221
222
for _ , container := range ds .Spec .Template .Spec .InitContainers {
222
- if container .Name == "intel-iaa-initcontainer" {
223
+ if container .Name == initcontainerName {
223
224
if container .Image != dp .Spec .InitImage {
224
225
update = true
225
226
}
@@ -231,7 +232,7 @@ func provisioningUpdate(ds *apps.DaemonSet, dp *devicepluginv1.IaaDevicePlugin)
231
232
}
232
233
233
234
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 {
235
236
update = true
236
237
237
238
break
0 commit comments