pbacsko commented on code in PR #918: URL: https://github.com/apache/yunikorn-k8shim/pull/918#discussion_r1799468007
########## pkg/cache/context.go: ########## @@ -370,15 +370,19 @@ func (ctx *Context) updateForeignPod(pod *v1.Pod) { // 2. pod is now assigned // 3. pod is not in terminated state // 4. pod references a known node - if oldPod == nil && utils.IsAssignedPod(pod) && !utils.IsPodTerminated(pod) { + if utils.IsAssignedPod(pod) && !utils.IsPodTerminated(pod) { if ctx.schedulerCache.UpdatePod(pod) { // pod was accepted by a real node log.Log(log.ShimContext).Debug("pod is assigned to a node, trigger occupied resource update", zap.String("namespace", pod.Namespace), zap.String("podName", pod.Name), zap.String("podStatusBefore", podStatusBefore), zap.String("podStatusCurrent", string(pod.Status.Phase))) - ctx.updateNodeOccupiedResources(pod.Spec.NodeName, pod.Namespace, pod.Name, common.GetPodResource(pod), schedulercache.AddOccupiedResource) + allocReq := common.CreateAllocationForForeignPod(pod) + if err := ctx.apiProvider.GetAPIs().SchedulerAPI.UpdateAllocation(allocReq); err != nil { + log.Log(log.ShimContext).Error("failed to add foreign allocation to the core", + zap.Error(err)) + } } else { // pod is orphaned (references an unknown node) log.Log(log.ShimContext).Info("skipping occupied resource update for assigned orphaned pod", Review Comment: Done ########## pkg/cache/context.go: ########## @@ -402,8 +406,12 @@ func (ctx *Context) updateForeignPod(pod *v1.Pod) { zap.String("podStatusCurrent", string(pod.Status.Phase))) // this means pod is terminated // we need sub the occupied resource and re-sync with the scheduler-core Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@yunikorn.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org