-
Notifications
You must be signed in to change notification settings - Fork 230
Allow skipping delete if a resource (or its parent) has already been removed #5040
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
base: main
Are you sure you want to change the base?
Conversation
dc40981 to
bdff1a4
Compare
c365c26 to
0a1d433
Compare
|
👋 Hi, I'm an automated AI code review bot. I ran some checks on this PR and found 1 point that might be worth attention (could be false positives, please use your judgment):
If you find these suggestions disruptive, you can reply "stop" , and I'll automatically skip this repository in the future. |
|
@juice928 stop. We welcome human contributors to ASO, and request that any AI contributions be human mediated/reviewed. |
Solves issue where the owner has stale state from Azure. * Removes owner from PreReconcileCheck. Owner checks must now always be done via PreReconcileOwnerCheck. This ensures that we only issue HTTP calls to Azure to refresh the owner state when we actually need the owner for something. * Resources that implement PreReconcileOwnerCheck now issue a GET on the owner ARM resource before calling the check, meaning that the check will always be acting on an up-to-date owner status + spec. * Remove possibility of owner being nil in PreReconcileOwnerCheck. We won't call that API at all if the owner is nil, which saves the individual check implementations from needing to always include a nil check. Test updates: * Updated Kuberentes version in tests and samples as the Kuberentes version we were using is now out of support. * Updated containerservice samples to use a different KeyVault name for each sample so that the KeyVault names don't collide when being recovered/purged. * Removed Test_Samples_CreationAndDeletion/Test_Dbforpostgresql_v20250801_CreationAndDeletion from the list of skipped samples. * Re-recorded required samples (containerservice and dbforpostgresql) Fixes Azure#5040.
matthchr
left a comment
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.
Approved with some comments I think you should take before merging
| if !skipDeletionPrecheck.Has(group) { | ||
| if _, _, err := r.getStatus(ctx, resourceID); err != nil { | ||
| if genericarmclient.IsNotFoundError(err) { | ||
| // Resource no longer exists |
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.
We used to always have this log:
log.V(Info).Info("Successfully issued DELETE to Azure")
now, it's possible we won't get that far. Should we have a log here that says something like
log.V(Info).Info("Determined resource was already deleted in Azure - not issuing DELETE as it is not required")
or something like that?
| . "github.com/onsi/gomega" | ||
| ) | ||
|
|
||
| func Test_hideAppConfigurationKeySecrets(t *testing.T) { |
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.
minor, style: Would it be better to test via the exported func (r *Redactor) HideRecordingData(s string) string { interface?
Feel like such a test scales better to testing the other redactions we have as well (good idea adding tests here btw).
| requeueDelay = 10 * time.Millisecond | ||
| minBackoff = 10 * time.Millisecond | ||
| maxBackoff = 10 * time.Millisecond | ||
| maxBackoff = 1000 * time.Millisecond |
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.
Can you expand on why this needs to be here? It's not mentioned in the PR description, or maybe a code-comment here would be useful?
Solves issue where the owner has stale state from Azure. * Removes owner from PreReconcileCheck. Owner checks must now always be done via PreReconcileOwnerCheck. This ensures that we only issue HTTP calls to Azure to refresh the owner state when we actually need the owner for something. * Resources that implement PreReconcileOwnerCheck now issue a GET on the owner ARM resource before calling the check, meaning that the check will always be acting on an up-to-date owner status + spec. * Remove possibility of owner being nil in PreReconcileOwnerCheck. We won't call that API at all if the owner is nil, which saves the individual check implementations from needing to always include a nil check. Test updates: * Updated Kuberentes version in tests and samples as the Kuberentes version we were using is now out of support. * Updated containerservice samples to use a different KeyVault name for each sample so that the KeyVault names don't collide when being recovered/purged. * Removed Test_Samples_CreationAndDeletion/Test_Dbforpostgresql_v20250801_CreationAndDeletion from the list of skipped samples. * Re-recorded required samples (containerservice and dbforpostgresql) Fixes Azure#5040.
Solves issue where the owner has stale state from Azure. * Removes owner from PreReconcileCheck. Owner checks must now always be done via PreReconcileOwnerCheck. This ensures that we only issue HTTP calls to Azure to refresh the owner state when we actually need the owner for something. * Resources that implement PreReconcileOwnerCheck now issue a GET on the owner ARM resource before calling the check, meaning that the check will always be acting on an up-to-date owner status + spec. * Remove possibility of owner being nil in PreReconcileOwnerCheck. We won't call that API at all if the owner is nil, which saves the individual check implementations from needing to always include a nil check. Test updates: * Updated Kuberentes version in tests and samples as the Kuberentes version we were using is now out of support. * Updated containerservice samples to use a different KeyVault name for each sample so that the KeyVault names don't collide when being recovered/purged. * Removed Test_Samples_CreationAndDeletion/Test_Dbforpostgresql_v20250801_CreationAndDeletion from the list of skipped samples. * Re-recorded required samples (containerservice and dbforpostgresql) Fixes Azure#5040.
What this PR does
Before issuing a DELETE to Azure, check to see if the resource has already been removed.
May resolve #5009 once all groups are migrated.
Special notes
Most groups are currently in a deny list (see
azure_generic_arm_reconciler_instance.go) so that we don't have to re-record all the groups at once. Tracking issue #5108 has been created for the follow-up tasks of removing groups from the deny-list.How does this PR make you feel?