Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use annotations instead of delete CRDs when terminate execution #5789

Closed

Conversation

andresgomezfrr
Copy link
Contributor

@andresgomezfrr andresgomezfrr commented Oct 1, 2024

Tracking issue

Closes #5786
Alternative to: #5788

Why are the changes needed?

To make sure that the propeller can handle the CRD before they are deleted if a terminated execution is called very fast.

New behavior:
Instead of propagating the terminate execution to the propeller deleting the CRD, the admin now updates a new aborted annotation, the propeller will check this annotation instead of the deletedTimestamp. If the annotation is there the propeller will send the ABORT event to the admin and remove the finalizer from the CRD. The propeller garbage-collector will clean up this CRD when it is executed.

What changes were proposed in this pull request?

Unit test + manual test in a staging environment with real flyte execution.

How was this patch tested?

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.

Project coverage is 36.31%. Comparing base (66ff152) to head (a1083e6).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
flyteadmin/pkg/workflowengine/impl/k8s_executor.go 50.00% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5789   +/-   ##
=======================================
  Coverage   36.31%   36.31%           
=======================================
  Files        1304     1304           
  Lines      110048   110058   +10     
=======================================
+ Hits        39964    39972    +8     
+ Misses      65928    65927    -1     
- Partials     4156     4159    +3     
Flag Coverage Δ
unittests-datacatalog 51.37% <ø> (ø)
unittests-flyteadmin 55.57% <50.00%> (-0.01%) ⬇️
unittests-flytecopilot 12.17% <ø> (ø)
unittests-flytectl 62.26% <ø> (+0.04%) ⬆️
unittests-flyteidl 7.12% <ø> (ø)
unittests-flyteplugins 53.35% <ø> (ø)
unittests-flytepropeller 41.93% <100.00%> (+<0.01%) ⬆️
unittests-flytestdlib 55.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Andres Gomez Ferrer <[email protected]>
Signed-off-by: Andres Gomez Ferrer <[email protected]>
@andresgomezfrr andresgomezfrr marked this pull request as ready for review October 1, 2024 12:26
Signed-off-by: Andres Gomez Ferrer <[email protected]>
@@ -103,7 +110,8 @@ func (p *Propeller) TryMutateWorkflow(ctx context.Context, originalW *v1alpha1.F
ctx = contextutils.WithResourceVersion(ctx, mutableW.GetResourceVersion())

maxRetries := uint32(p.cfg.MaxWorkflowRetries)
if IsDeleted(mutableW) || (mutableW.Status.FailedAttempts > maxRetries) {

if IsAborted(mutableW) || (mutableW.Status.FailedAttempts > maxRetries) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could still have the case that the CRD gets deleted by some other process and should still account for that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmmh could be? Looking inside the if, the function there looks like is only for aborting case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added back the isDeleted(...) to manage this case here too, now it is backward compatible, wdyt?

w.ObjectMeta.Annotations = make(map[string]string)
}

w.ObjectMeta.Annotations[AbortedWorkflowAnnotation] = "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concern here is if there's a case that this delete is required to delete dangling CRDs (not picked up by propeller)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess.. that the dangling CRDs should be removed by propeller GC, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the same case as completed workflows/failed workflows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concern here is if there's a case that this delete is required to delete dangling CRDs (not picked up by propeller)

If the concern is about deleting CRDs if the propeller is down.. what do you think about having a flag in the terminate to force the delete from the admin? Similar to kubectl delete --force which force the deletion of a CRD.

@andresgomezfrr andresgomezfrr requested a review from pvditt October 2, 2024 06:44
Signed-off-by: Andres Gomez Ferrer <[email protected]>
@RRap0so RRap0so closed this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Aborting Sub-Workflows filling up the admin-launcher Cache
3 participants