kubernetes-sigs / cli-utils

This repo contains binaries that built from libraries in cli-runtime.
Apache License 2.0
156 stars 78 forks source link

fix: race condition in PruneTask #469

Closed karlkfi closed 3 years ago

karlkfi commented 3 years ago

The Pruner modifies the input object when the deletion prevention annotation is present. This in turn modifies the object map, which creates a race condition when reading the object map from the task runner. To fix the race, a copy of the object is made, but only if the deletion prevention filter prevents deletion.

haiyanmeng commented 3 years ago

Pleas fix the cli-utils-presubmit-master failure.

Otherwise, LGTM.

karlkfi commented 3 years ago

Tests fixed.

haiyanmeng commented 3 years ago

/lgtm

mortent commented 3 years ago

/approve

k8s-ci-robot commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: karlkfi, mortent

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/cli-utils/blob/master/OWNERS)~~ [mortent] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment