Skip to content

Bug: ASO should not try to delete undeletable resources #3975

@theunrepentantgeek

Description

@theunrepentantgeek

Version of Azure Service Operator

v2.7.0 (and earlier)

Describe the bug

Discovered while testing API version 2023-11-15 of documentdb - the type SqlDatabaseContainerThroughputSetting may not be deleted directly via ARM.

ASO knows this already, as we generate the correct list of supported operations in sql_database_container_throughput_setting_types_gen.go:

// GetSupportedOperations returns the operations supported by the resource
func (setting *SqlDatabaseContainerThroughputSetting) GetSupportedOperations() []genruntime.ResourceOperation {
	return []genruntime.ResourceOperation{
		genruntime.ResourceOperationGet,
		genruntime.ResourceOperationPut,
	}
}

However, we don't respect that when running, resulting in noisy errors:

test_logger.go:160: I2024-04-28T22:19:01Z] SqlDatabaseThroughputSettingController 
    "msg"="Error during Delete" 
    "err"="deleting resource "/subscriptions/82acd5bb-4206-47d4-9c12-a65db028483d/resourceGroups/asotest-rg-aokpof/providers/Microsoft.DocumentDB/databaseAccounts/sample-sqldb-account/sqlDatabases/sample-sql-db/throughputSettings/default": DELETE https://management.azure.com/subscriptions/82acd5bb-4206-47d4-9c12-a65db028483d/resourceGroups/asotest-rg-aokpof/providers/Microsoft.DocumentDB/databaseAccounts/sample-sqldb-account/sqlDatabases/sample-sql-db/throughputSettings/default
    --------------------------------------------------------------------------------
    RESPONSE 405: 405 Method Not Allowed
    ERROR CODE: MethodNotAllowed
    --------------------------------------------------------------------------------
    {
      "code": "MethodNotAllowed",
      "message": "Message: The requested verb is not supported."
    }
    --------------------------------------------------------------------------------
    " name="sample-sql-throughput" 
    namespace="aso-test-samples-creationanddeletion-test-sqldatabase-v1a-7e1fc" 
    azureName="default" 
    action="BeginDelete"

Expected behavior

We should respect the available verbs for the resource, and skip deletion from Azure where it's not possible, even though this may produce results surprising for some users.

Metadata

Metadata

Type

No type

Projects

Status

Up Next

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions