Skip to content

Commit

Permalink
Avoid premature CRD Deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Raposo <rafaelraposo@spotify.com>
  • Loading branch information
RRap0so committed Sep 30, 2024
1 parent 66ff152 commit bc82a62
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions flyteadmin/pkg/workflowengine/impl/k8s_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ func (e K8sWorkflowExecutor) Abort(ctx context.Context, data interfaces.AbortDat
if err != nil {
return errors.NewFlyteAdminErrorf(codes.Internal, err.Error())
}
// Check if the execution has been handled by FlytePropeller
crd, err := target.FlyteClient.FlyteworkflowV1alpha1().FlyteWorkflows(data.Namespace).Get(ctx, data.ExecutionID.GetName(), v1.GetOptions{})
if err != nil {
return errors.NewFlyteAdminErrorf(codes.Internal, err.Error())
}

if crd.Generation < 2 {
logger.Infof(ctx, "Execution [%v] hasn't been handled by FlytePropeller", data.ExecutionID)
return nil
}

err = target.FlyteClient.FlyteworkflowV1alpha1().FlyteWorkflows(data.Namespace).Delete(ctx, data.ExecutionID.GetName(), v1.DeleteOptions{
PropagationPolicy: &deletePropagationBackground,
})
Expand Down

0 comments on commit bc82a62

Please sign in to comment.