pbacsko commented on code in PR #847:
URL: https://github.com/apache/yunikorn-k8shim/pull/847#discussion_r1611930192
##########
pkg/cache/context.go:
##########
@@ -1727,13 +1729,21 @@ func (ctx *Context) finalizePods(existingPods
[]*v1.Pod) error {
// convert the pod list into a map
podMap := make(map[types.UID]*v1.Pod)
for _, pod := range pods {
+ // if the pod is terminated finalising should remove it if it
was running in register
+ if utils.IsPodTerminated(pod) {
+ continue
+ }
podMap[pod.UID] = pod
}
- // find any existing nodes that no longer exist
+ // find any existing pods that no longer exist
for _, pod := range existingPods {
+ // skip if the pod was already terminated during register
+ if pod == nil {
+ continue
+ }
if _, ok := podMap[pod.UID]; !ok {
- // node no longer exists, delete it
+ // pod no longer exists, delete it
Review Comment:
I'm planning to enhance test coverage for `Context`, we can have a separate
test case for `DeletePod()` to make sure that's idempotent. But we can do this
in this PR as well.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]