mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
pkg/deviceplugin: do not reset Envs/Annotations from previous loops
When more than one device ID is Allocate()'d to a container,
Envs/Annotations for all but the last device ID get lost because
their cresp.* maps are (re-)instantiated on each loop.
Fix it by doing that only once.
Fixes: 55f3e17
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
parent
fd67c5cd6f
commit
4fa7c4cb23
@ -143,6 +143,9 @@ func (srv *server) Allocate(ctx context.Context, rqt *pluginapi.AllocateRequest)
|
||||
for _, crqt := range rqt.ContainerRequests {
|
||||
cresp := new(pluginapi.ContainerAllocateResponse)
|
||||
|
||||
cresp.Envs = map[string]string{}
|
||||
cresp.Annotations = map[string]string{}
|
||||
|
||||
for _, id := range crqt.DevicesIDs {
|
||||
dev, ok := srv.devices[id]
|
||||
if !ok {
|
||||
@ -161,14 +164,10 @@ func (srv *server) Allocate(ctx context.Context, rqt *pluginapi.AllocateRequest)
|
||||
cresp.Mounts = append(cresp.Mounts, &dev.mounts[i])
|
||||
}
|
||||
|
||||
cresp.Envs = map[string]string{}
|
||||
|
||||
for key, value := range dev.envs {
|
||||
cresp.Envs[key] = value
|
||||
}
|
||||
|
||||
cresp.Annotations = map[string]string{}
|
||||
|
||||
for key, value := range dev.annotations {
|
||||
cresp.Annotations[key] = value
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user