Skip to content

Commit 9df9a18

Browse files
authored
Merge pull request #1343 from mythi/PR-2023-013
pkg/deviceplugin: do not reset Envs/Annotations from previous loops
2 parents 45366b1 + 4fa7c4c commit 9df9a18

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/deviceplugin/server.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ func (srv *server) Allocate(ctx context.Context, rqt *pluginapi.AllocateRequest)
143143
for _, crqt := range rqt.ContainerRequests {
144144
cresp := new(pluginapi.ContainerAllocateResponse)
145145

146+
cresp.Envs = map[string]string{}
147+
cresp.Annotations = map[string]string{}
148+
146149
for _, id := range crqt.DevicesIDs {
147150
dev, ok := srv.devices[id]
148151
if !ok {
@@ -161,14 +164,10 @@ func (srv *server) Allocate(ctx context.Context, rqt *pluginapi.AllocateRequest)
161164
cresp.Mounts = append(cresp.Mounts, &dev.mounts[i])
162165
}
163166

164-
cresp.Envs = map[string]string{}
165-
166167
for key, value := range dev.envs {
167168
cresp.Envs[key] = value
168169
}
169170

170-
cresp.Annotations = map[string]string{}
171-
172171
for key, value := range dev.annotations {
173172
cresp.Annotations[key] = value
174173
}

0 commit comments

Comments
 (0)