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

Prevent orphaned resources for cancellation during delete #368

Merged
merged 4 commits into from
Jan 24, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,27 @@ func (k *kubeProvider) Delete(
Name: name,
}

err = await.Deletion(config)
if err != nil {
return nil, err
awaitErr := await.Deletion(config)
if awaitErr != nil {
initErr, isInitErr := awaitErr.(await.InitializationError)
if !isInitErr {
// Object deletion failed.
lblackstone marked this conversation as resolved.
Show resolved Hide resolved
return nil, awaitErr
}

lastKnownState := initErr.Object()

inputsAndComputed, err := plugin.MarshalProperties(
checkpointObject(current, lastKnownState), plugin.MarshalOptions{
Label: fmt.Sprintf("%s.inputsAndComputed", label), KeepUnknowns: true, SkipNulls: true,
})
if err != nil {
return nil, err
}

// Resource delete was issued, but failed to complete. Return live version of object so it can be
// checkpointed.
return nil, initializationError(FqObjName(lastKnownState), awaitErr, inputsAndComputed)
}

return &pbempty.Empty{}, nil
Expand Down