Skip to content

Commit b7c9478

Browse files
committed
fix: creating multiple pods at the same time will be assigned to the same NPU.
Signed-off-by: lomtom <lomtom@qq.com>
1 parent caa5b03 commit b7c9478

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/server/server.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,14 @@ func (ps *PluginServer) Allocate(ctx context.Context, reqs *v1beta1.AllocateRequ
350350
success := false
351351
var pod *v1.Pod
352352
defer func() {
353+
if success {
354+
annotations := make(map[string]string)
355+
annotations[util.DeviceBindPhase] = util.DeviceBindSuccess
356+
err := util.PatchPodAnnotations(pod, annotations)
357+
if err != nil {
358+
klog.Errorf("patch pod %s annotations error: %v", pod.Name, err)
359+
}
360+
}
353361
lockerr := nodelock.ReleaseNodeLock(ps.nodeName, NodeLockAscend, pod, success)
354362
if lockerr != nil {
355363
klog.Errorf("failed to release lock:%s", lockerr.Error())

0 commit comments

Comments
 (0)