Open chaosi-zju opened 2 weeks ago
/hold
for #4875 #4860
/hold cancel
Attention: Patch coverage is 9.21053%
with 69 lines
in your changes are missing coverage. Please review.
Project coverage is 53.07%. Comparing base (
6cfed59
) to head (98845e0
). Report is 8 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
...lers/workloadrebalancer/ttlafterfinished_worker.go | 0.00% | 52 Missing :warning: |
...orkloadrebalancer/workloadrebalancer_controller.go | 29.16% | 13 Missing and 4 partials :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
CC @RainbowMango can this begin to review?
/assign
By the way.
If this field is set, ttlSecondsAfterFinished after the WorkloadRebalancer finishes, it is eligible to be automatically deleted.
ttlSecondsAfterFinished
--> ttlMinutesAfterFinished
in the PR description.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: To complete the pull request process, please ask for approval from rainbowmango after the PR has been reviewed.
The full list of commands accepted by this bot can be found here.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Support auto delete WorkloadRebalancer when time up:
referring to Automatic Cleanup for Finished Jobs.
Introduces field
ttlSecondsAfterFinished
which limits the lifetime of a WorkloadRebalancer that has finished execution (finished execution means each target workload is finished with result ofSuccessful
orFailed
).ttlSecondsAfterFinished
after the WorkloadRebalancer finishes, it is eligible to be automatically deleted.Considering several corner cases:
WorkloadRebalancer
beforettlSecondsAfterFinished
expired, which means the finish time of theWorkloadRebalancer
is refreshed, so thedelete
action is deferred since expire time is refreshed too.ttlSecondsAfterFinished
is modified beforettlSecondsAfterFinished
expired,delete
action should be performed according to latestttlSecondsAfterFinished
.WorkloadRebalancer
object and try to delete it, if a modification toWorkloadRebalancer
occurred just right between the two time point, the previousdelete
action should be Interrupted.Several key implementation:
WorkloadRebalancer
is judged as finished should meet two requirements:Successful
orFailed
.ObservedGeneration
toStatus
of WorkloadRebalancer, and it should be equal to.metadata.Generation
, to prevent that the WorkloadRebalancer is updated but controller hasn't in time refreshed itsStatus
.WorkloadRebalancer
isCreated
orUpdated
, add it to the workqueue and calculate its expiring time, and callworkqueue.AddAfter()
function to re-enqueue it once more if it hasn't expired.WorkloadRebalancer
, do a final sanity check. Use the latestWorkloadRebalancer
directly fetched from api server to see if the TTL truly expires, rather than object from lister cache.WorkloadRebalancer
, it is needed to confirm that theresourceVersion
of the deleted object is as expected, to prevent from above corner case 3.Which issue(s) this PR fixes:
Fixes part of #4840
Special notes for your reviewer:
Does this PR introduce a user-facing change?: