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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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 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, and avoid unnecessary Delete calls if obj does not exist. 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

duration: 232.507687ms
status: 200 OK
code: 200
duration: 245.142672ms
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.

While idk why this changed, but I think the destroy version operation should return 200 instead of 404

Edit: This is handled in #3825, if version already got destroyed(404), we should not make the API call.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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