-
Notifications
You must be signed in to change notification settings - Fork 974
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
Fix deletion not found handling in the delete operation and adding related tests #2592
Fix deletion not found handling in the delete operation and adding related tests #2592
Conversation
.changelog/2592.txt
Outdated
@@ -0,0 +1,3 @@ | |||
```release-note:enhancement | |||
handling "404 Not Found" errors during the deletion of Kubernetes resources, particularly in cases where the resource may have already been deleted by an operator managing the CRD before Terraform attempts to delete it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a reference to the manifest resource here, to make it clear this change only affects its behaviour.
handling "404 Not Found" errors during the deletion of Kubernetes resources, particularly in cases where the resource may have already been deleted by an operator managing the CRD before Terraform attempts to delete it. | |
`kubernetes_manifest` - handling "404 Not Found" errors during the deletion of Kubernetes resources, particularly in cases where the resource may have already been deleted by an operator managing the CRD before Terraform attempts to delete it. |
manifest/provider/apply.go
Outdated
Summary: fmt.Sprintf("Error deleting resource %s: %s", rname, err), | ||
Detail: err.Error(), | ||
}) | ||
return resp, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this return
line needs to go outside of the else
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only a couple of small tidy-ups needed. See my comments above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @JaylonmcShan03!
Thanks for taking care of this issue!
Description
Fixes #2188
This PR introduces changes to handle "404 Not Found" errors during the deletion of Kubernetes resources, particularly in cases where the resource may have already been deleted by an operator managing the CRD before Terraform attempts to delete it.
Changes Introduced:
Added logic to check for IsNotFound(err) when calling Delete on resources.
If a "404 Not Found" error is encountered, it is now treated as a successful deletion and logged as "Resource
already deleted, ignoring 404 error".
Other errors during deletion will continue to be handled as before.
Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Community Note