Skip to content

Commit 0ea39ad

Browse files
committed
pkg/storage/azure: also check for auth failure error code on deletion
I cannot explain the behavior, but after networkAccess to Internal in the operator config, if the operator tries to delete the container (which happens setting managementState to Removed in the config), the call to DeleteStorageContainer fails with a bloberror.AuthorizationFailure, despite the operator having the "containers/delete" permission in its CredentialsRequest. Note that setting networkAccess to Internal triggers the operator to create a private endpoint in Azure, then disable public access to the storage account in question. This could be related to the issue.
1 parent bf2a0d5 commit 0ea39ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/storage/azure/azure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ func (d *driver) removeStorageContainerViaTrack2SDK(cr *imageregistryv1.Config,
11421142
}
11431143
err = blobClient.DeleteStorageContainer(d.Context, d.Config.Container)
11441144
if err != nil {
1145-
if bloberror.HasCode(err, bloberror.AuthorizationPermissionMismatch) {
1145+
if bloberror.HasCode(err, bloberror.AuthorizationPermissionMismatch) || bloberror.HasCode(err, bloberror.AuthorizationFailure) {
11461146
util.UpdateCondition(cr, defaults.StorageExists, operatorapiv1.ConditionUnknown, storageExistsReasonAzureError, fmt.Sprintf("Unable to delete storage container due to delete container permission missing, trying account deletion: %s", err))
11471147
return false, nil
11481148
} else if bloberror.HasCode(err, "AccountNotFound") {

0 commit comments

Comments
 (0)