Skip to content

chore: Handle deletion when the underlying GCP resource does not exist #3826

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

Closed

Conversation

gemmahou
Copy link
Collaborator

@gemmahou gemmahou commented Mar 1, 2025

Change description

Fixes #3727

Tests you have done

  • Run make ready-pr to ensure this PR is ready for review.
  • Perform necessary E2E testing for changed resources.

// and (false, nil) if the object was not found but should be presumed deleted.
// In an error, the state is not fully determined - a delete might be in progress.
// It returns (true, nil) if the object was deleted without error.
// In an error (false, err), the state is not fully determined - a delete might be in progress.
Delete(ctx context.Context, op *DeleteOperation) (deleted bool, err error)
Copy link
Collaborator Author

@gemmahou gemmahou Mar 1, 2025

Choose a reason for hiding this comment

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

I feel the returned deleted bool might be unnecessary, but I'm open to discussion:

  1. it's not used anywhere for now:
    if _, err := adapter.Delete(ctx, deleteOp); err != nil {
  2. the situation return (false, nil) if the object was not found but should be presumed deleted, we could call Find to determine the existence of the GCP obj, to avoid unnecessary Delete calls. Also We don't have specific handling for the case of (false, nil); instead, we treat it the same as (true, nil).

This can be called without calling Find. Unsure if there's a use case of it I haven't considered...

@gemmahou gemmahou force-pushed the handle-delete-notexist branch from 080046e to 26bab12 Compare March 1, 2025 00:32
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from yuwenma. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@jasonvigil jasonvigil left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Mar 3, 2025
@gemmahou gemmahou force-pushed the handle-delete-notexist branch from 38746e9 to b8f0e35 Compare April 21, 2025 18:52
@google-oss-prow google-oss-prow bot removed the lgtm label Apr 21, 2025
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@gemmahou
Copy link
Collaborator Author

Discussed with Joyce offline, I'll handle this issue in #4621

@gemmahou gemmahou closed this May 22, 2025
@gemmahou gemmahou deleted the handle-delete-notexist branch May 22, 2025 19:49
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.

Handle deletion when the underlying GCP resource does not exist
4 participants