diff --git a/v2/internal/controllers/crd_eventgrid_domain_test.go b/v2/internal/controllers/crd_eventgrid_domain_test.go index ffd080166bd..dde254af46b 100644 --- a/v2/internal/controllers/crd_eventgrid_domain_test.go +++ b/v2/internal/controllers/crd_eventgrid_domain_test.go @@ -60,6 +60,7 @@ func Test_EventGrid_Domain(t *testing.T) { Owner: testcommon.AsOwner(acct), }, } + tc.AddAnnotation(&queueServices.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(queueServices) diff --git a/v2/internal/controllers/crd_eventgrid_topic_test.go b/v2/internal/controllers/crd_eventgrid_topic_test.go index d81afa5b8e7..328748e15c0 100644 --- a/v2/internal/controllers/crd_eventgrid_topic_test.go +++ b/v2/internal/controllers/crd_eventgrid_topic_test.go @@ -116,6 +116,9 @@ func Topic_Subscription_CRUD(tc *testcommon.KubePerTestContext, rg *resources.Re }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&queueService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(queueService) queue := &storage.StorageAccountsQueueServicesQueue{ diff --git a/v2/internal/controllers/crd_dataprotection_backupinstance_20231101_test.go b/v2/internal/controllers/dataprotection_backupinstance_crud_20231101_test.go similarity index 98% rename from v2/internal/controllers/crd_dataprotection_backupinstance_20231101_test.go rename to v2/internal/controllers/dataprotection_backupinstance_crud_20231101_test.go index f7fa931d2da..67cba5c2282 100644 --- a/v2/internal/controllers/crd_dataprotection_backupinstance_20231101_test.go +++ b/v2/internal/controllers/dataprotection_backupinstance_crud_20231101_test.go @@ -71,6 +71,9 @@ func Test_DataProtection_BackupInstance_20231101_CRUD(t *testing.T) { }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&blobService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + blobContainer := &storage.StorageAccountsBlobServicesContainer{ ObjectMeta: tc.MakeObjectMeta("velero"), Spec: storage.StorageAccountsBlobServicesContainer_Spec{ diff --git a/v2/internal/controllers/dbformysql_flexibleserver_20210501_test.go b/v2/internal/controllers/dbformysql_flexibleserver_20210501_test.go index 0acfda17610..ef07b0a7552 100644 --- a/v2/internal/controllers/dbformysql_flexibleserver_20210501_test.go +++ b/v2/internal/controllers/dbformysql_flexibleserver_20210501_test.go @@ -244,6 +244,8 @@ func MySQLFlexibleServer_Configuration_20220101_CRUD(tc *testcommon.KubePerTestC Value: to.Ptr("20"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(configuration) tc.Expect(configuration.Status.Id).ToNot(BeNil()) } diff --git a/v2/internal/controllers/dbformysql_flexibleserver_20230630_test.go b/v2/internal/controllers/dbformysql_flexibleserver_20230630_test.go index 9cb7121851e..1d0db645277 100644 --- a/v2/internal/controllers/dbformysql_flexibleserver_20230630_test.go +++ b/v2/internal/controllers/dbformysql_flexibleserver_20230630_test.go @@ -243,6 +243,8 @@ func MySQLFlexibleServer_Configuration_20230630_CRUD(tc *testcommon.KubePerTestC Value: to.Ptr("20"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(configuration) tc.Expect(configuration.Status.Id).ToNot(BeNil()) } diff --git a/v2/internal/controllers/dbformysql_flexibleserver_20231230_test.go b/v2/internal/controllers/dbformysql_flexibleserver_20231230_test.go index d07d64dd5c2..2320664993e 100644 --- a/v2/internal/controllers/dbformysql_flexibleserver_20231230_test.go +++ b/v2/internal/controllers/dbformysql_flexibleserver_20231230_test.go @@ -238,6 +238,8 @@ func MySQLFlexibleServer_Configuration_20231230_CRUD(tc *testcommon.KubePerTestC Value: to.Ptr("20"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(configuration) tc.Expect(configuration.Status.Id).ToNot(BeNil()) } diff --git a/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20221201_test.go b/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20221201_test.go index 124383b74cd..0920670ac99 100644 --- a/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20221201_test.go +++ b/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20221201_test.go @@ -166,6 +166,7 @@ func FlexibleServer_Configuration_20221201_CRUD(tc *testcommon.KubePerTestContex Value: to.Ptr("READ"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(configuration) // This isn't a "real" resource so it cannot be deleted directly diff --git a/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20230601preview_test.go b/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20230601preview_test.go index 36b03888bdb..bb52a2d25c3 100644 --- a/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20230601preview_test.go +++ b/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20230601preview_test.go @@ -203,6 +203,7 @@ func FlexibleServer_Configuration_20230601Preview_CRUD(tc *testcommon.KubePerTes Value: to.Ptr("READ"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(configuration) // This isn't a "real" resource so it cannot be deleted directly diff --git a/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20240801_test.go b/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20240801_test.go index bb5921d462c..79e2ab765e7 100644 --- a/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20240801_test.go +++ b/v2/internal/controllers/dbforpostgresql_flexibleserver_crud_v1api20240801_test.go @@ -225,6 +225,7 @@ func FlexibleServer_Configuration_20240801_CRUD(tc *testcommon.KubePerTestContex Value: to.Ptr("READ"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(configuration) // This isn't a "real" resource so it cannot be deleted directly @@ -261,9 +262,10 @@ func FlexibleServer_AdvancedThreatProtection_20240801_CRUD(tc *testcommon.KubePe }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&threatProtection.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(threatProtection) - // This isn't a "real" resource so it cannot be deleted directly - // defer tc.DeleteResourceAndWait(threatProtection) tc.Expect(threatProtection.Status.Id).ToNot(BeNil()) } diff --git a/v2/internal/controllers/documentdb_mongodb_crud_v20210515_test.go b/v2/internal/controllers/documentdb_mongodb_crud_v20210515_test.go index 6e62281d204..81324402f1d 100644 --- a/v2/internal/controllers/documentdb_mongodb_crud_v20210515_test.go +++ b/v2/internal/controllers/documentdb_mongodb_crud_v20210515_test.go @@ -175,6 +175,7 @@ func CosmosDB_MongoDB_Database_ThroughputSettings_CRUD(tc *testcommon.KubePerTes }, }, } + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.T.Log("creating mongo database throughput") tc.CreateResourceAndWait(&throughputSettings) @@ -205,9 +206,11 @@ func CosmosDB_MongoDB_Database_Collections_ThroughputSettings_CRUD(tc *testcommo }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.T.Log("creating mongo database collections throughput") tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) diff --git a/v2/internal/controllers/documentdb_mongodb_crud_v20231115_test.go b/v2/internal/controllers/documentdb_mongodb_crud_v20231115_test.go index 99bce48198a..97fe1e77eeb 100644 --- a/v2/internal/controllers/documentdb_mongodb_crud_v20231115_test.go +++ b/v2/internal/controllers/documentdb_mongodb_crud_v20231115_test.go @@ -198,6 +198,7 @@ func DocumentDB_MongoDB_Database_ThroughputSettings_v20231115_CRUD(tc *testcommo }, }, } + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.T.Log("creating mongo database throughput") tc.CreateResourceAndWait(&throughputSettings) @@ -228,9 +229,11 @@ func DocumentDB_MongoDB_Database_Collections_ThroughputSettings_v20231515_CRUD(t }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.LogSectionf("creating mongo database collections throughput") tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) diff --git a/v2/internal/controllers/documentdb_mongodb_crud_v20240815_test.go b/v2/internal/controllers/documentdb_mongodb_crud_v20240815_test.go index 057c963727e..e192beb58fb 100644 --- a/v2/internal/controllers/documentdb_mongodb_crud_v20240815_test.go +++ b/v2/internal/controllers/documentdb_mongodb_crud_v20240815_test.go @@ -221,6 +221,7 @@ func DocumentDB_MongoDB_Database_ThroughputSettings_v20240815_CRUD(tc *testcommo }, }, } + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.T.Log("creating mongo database throughput") tc.CreateResourceAndWait(&throughputSettings) @@ -251,9 +252,11 @@ func DocumentDB_MongoDB_Database_Collections_ThroughputSettings_v20240815_CRUD(t }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.LogSectionf("creating mongo database collections throughput") tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) diff --git a/v2/internal/controllers/documentdb_sql_crud_v20231115_test.go b/v2/internal/controllers/documentdb_sql_crud_v20231115_test.go index 2ca8f9cf88f..0c55d777885 100644 --- a/v2/internal/controllers/documentdb_sql_crud_v20231115_test.go +++ b/v2/internal/controllers/documentdb_sql_crud_v20231115_test.go @@ -326,9 +326,11 @@ func CosmosDB_SQL_Database_ThroughputSettings_v20231115_CRUD(tc *testcommon.Kube }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + // Create the resource tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) @@ -359,9 +361,11 @@ func CosmosDB_SQL_Database_Container_ThroughputSettings_v20231115_CRUD(tc *testc }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + // Create the resource tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) diff --git a/v2/internal/controllers/documentdb_sql_crud_v20240815_test.go b/v2/internal/controllers/documentdb_sql_crud_v20240815_test.go index 08e88c30307..c9ed881c7c6 100644 --- a/v2/internal/controllers/documentdb_sql_crud_v20240815_test.go +++ b/v2/internal/controllers/documentdb_sql_crud_v20240815_test.go @@ -325,9 +325,11 @@ func CosmosDB_SQL_Database_ThroughputSettings_v20240815_CRUD(tc *testcommon.Kube }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + // Create the resource tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) @@ -358,9 +360,11 @@ func CosmosDB_SQL_Database_Container_ThroughputSettings_v20240815_CRUD(tc *testc }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&throughputSettings.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + // Create the resource tc.CreateResourceAndWait(&throughputSettings) - // no DELETE, this is not a real resource - to delete it you must delete its parent // Ensure that the status is what we expect tc.Expect(throughputSettings.Status.Id).ToNot(BeNil()) diff --git a/v2/internal/controllers/insights_component_crud_20200202_test.go b/v2/internal/controllers/insights_component_crud_20200202_test.go index b5a61bb30f9..585281fc36a 100644 --- a/v2/internal/controllers/insights_component_crud_20200202_test.go +++ b/v2/internal/controllers/insights_component_crud_20200202_test.go @@ -152,6 +152,9 @@ func Insights_PricingPlan_20171001_CRUD( }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&plan.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(plan) tc.Expect(plan.Status.PlanType).NotTo(BeNil()) diff --git a/v2/internal/controllers/crd_mariadb_server_test.go b/v2/internal/controllers/mariadb_server_crud_20180601_test.go similarity index 83% rename from v2/internal/controllers/crd_mariadb_server_test.go rename to v2/internal/controllers/mariadb_server_crud_20180601_test.go index 491d0aa30a4..86928f742c9 100644 --- a/v2/internal/controllers/crd_mariadb_server_test.go +++ b/v2/internal/controllers/mariadb_server_crud_20180601_test.go @@ -32,7 +32,7 @@ func Test_MariaDB_Server_CRUD(t *testing.T) { adminUser := "testadmin" adminPasswordRef := createPasswordSecret("admin", "password", tc) - server := mariadb.Server{ + server := &mariadb.Server{ ObjectMeta: tc.MakeObjectMetaWithName(serverName), Spec: mariadb.Server_Spec{ AzureName: serverName, @@ -65,37 +65,29 @@ func Test_MariaDB_Server_CRUD(t *testing.T) { }, } - tc.T.Logf("Creating MariaDB Server %q", serverName) - tc.CreateResourcesAndWait(&server) - - tc.ExpectSecretHasKeys(fqdnSecret, "fqdn") - // Configuration configName := tc.NoSpaceNamer.GenerateName("mcfg") - configuration := mariadb.Configuration{ + configuration := &mariadb.Configuration{ ObjectMeta: tc.MakeObjectMetaWithName(configName), Spec: mariadb.Configuration_Spec{ AzureName: "query_cache_size", - Owner: testcommon.AsOwner(&server), + Owner: testcommon.AsOwner(server), Value: to.Ptr("102400"), }, } + tc.AddAnnotation(&configuration.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") - tc.T.Logf("Creating MariaDB Configuration %q", configName) - tc.CreateResourcesAndWait(&configuration) - // Can't delete, so don't even try // defer tc.DeleteResourcesAndWait(&configuration) - - database := mariadb.Database{ + database := &mariadb.Database{ ObjectMeta: tc.MakeObjectMetaWithName(configName), Spec: mariadb.Database_Spec{ AzureName: *to.Ptr("adventureworks"), - Owner: testcommon.AsOwner(&server), + Owner: testcommon.AsOwner(server), }, } - tc.T.Logf("Creating MariaDB Database %q", database.Spec.AzureName) - tc.CreateResourcesAndWait(&database) + tc.CreateResourcesAndWait(server, database, configuration) + tc.ExpectSecretHasKeys(fqdnSecret, "fqdn") } func createPasswordSecret( diff --git a/v2/internal/controllers/owner_arm_id_test.go b/v2/internal/controllers/owner_arm_id_test.go index 7eb78cfa66b..71a22b59b2b 100644 --- a/v2/internal/controllers/owner_arm_id_test.go +++ b/v2/internal/controllers/owner_arm_id_test.go @@ -73,6 +73,7 @@ func Test_OwnerIsARMIDOfParent_ChildResourceSuccessfullyReconciled(t *testing.T) Owner: testcommon.AsOwner(acct), }, } + tc.AddAnnotation(&blobService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(blobService) tc.Expect(blobService.Status.Id).ToNot(BeNil()) diff --git a/v2/internal/controllers/crd_sql_server_test.go b/v2/internal/controllers/sql_server_crud_v20211101_test.go similarity index 91% rename from v2/internal/controllers/crd_sql_server_test.go rename to v2/internal/controllers/sql_server_crud_v20211101_test.go index a619282bf7b..dd99543b81b 100644 --- a/v2/internal/controllers/crd_sql_server_test.go +++ b/v2/internal/controllers/sql_server_crud_v20211101_test.go @@ -145,12 +145,12 @@ func SQL_Server_ConnectionPolicy_CRUD(tc *testcommon.KubePerTestContext, server }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&policy.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(policy) tc.Expect(policy.Status.Id).ToNot(BeNil()) - - // TODO: Delete is not allowed for this resource - // tc.DeleteResourceAndWait(policy) } func SQL_Server_AdvancedThreatProtection_CRUD(tc *testcommon.KubePerTestContext, server *sql.Server) { @@ -163,6 +163,9 @@ func SQL_Server_AdvancedThreatProtection_CRUD(tc *testcommon.KubePerTestContext, }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&policy.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(policy) tc.Expect(policy.Status.Id).ToNot(BeNil()) @@ -181,6 +184,9 @@ func SQL_Server_VulnerabilityAssessments_CRUD(tc *testcommon.KubePerTestContext, }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&alertPolicy.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(alertPolicy) tc.Expect(alertPolicy.Status.Id).ToNot(BeNil()) @@ -275,6 +281,9 @@ func SQL_Server_AuditingSetting_CRUD(tc *testcommon.KubePerTestContext, server * }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&auditingSetting.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(auditingSetting) tc.Expect(auditingSetting.Status.Id).ToNot(BeNil()) @@ -482,6 +491,9 @@ func SQL_BackupLongTermRetention_CRUD(tc *testcommon.KubePerTestContext, db *sql }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&policy.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(policy) tc.Expect(policy.Status.Id).ToNot(BeNil()) } @@ -496,6 +508,9 @@ func SQL_Database_VulnerabilityAssessment_CRUD(tc *testcommon.KubePerTestContext }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&securityAlertPolicy.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(securityAlertPolicy) tc.Expect(securityAlertPolicy.Status.Id).ToNot(BeNil()) @@ -552,12 +567,12 @@ func SQL_Database_AuditingSetting_CRUD(tc *testcommon.KubePerTestContext, db *sq }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&auditingSetting.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(auditingSetting) tc.Expect(auditingSetting.Status.Id).ToNot(BeNil()) - - // Resource doesn't support delete - // tc.DeleteResourceAndWait(auditingSetting) } func SQL_Database_TransparentDataEncryption_CRUD(tc *testcommon.KubePerTestContext, db *sql.ServersDatabase) { @@ -570,12 +585,12 @@ func SQL_Database_TransparentDataEncryption_CRUD(tc *testcommon.KubePerTestConte }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&transparentDataEncryption.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(transparentDataEncryption) tc.Expect(transparentDataEncryption.Status.Id).ToNot(BeNil()) - - // Delete is not supported for this resource - // tc.DeleteResourceAndWait(transparentDataEncryption) } func SQL_Database_AdvancedThreatProtection_CRUD(tc *testcommon.KubePerTestContext, db *sql.ServersDatabase) { @@ -588,6 +603,9 @@ func SQL_Database_AdvancedThreatProtection_CRUD(tc *testcommon.KubePerTestContex }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&advancedProtection.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(advancedProtection) tc.Expect(advancedProtection.Status.Id).ToNot(BeNil()) @@ -639,12 +657,17 @@ func makeStorageAccountForSQLVulnerabilityAssessment(tc *testcommon.KubePerTestC }, }, } + blobService := &storage.StorageAccountsBlobService{ ObjectMeta: tc.MakeObjectMeta("blobservice"), Spec: storage.StorageAccountsBlobService_Spec{ Owner: testcommon.AsOwner(acct), }, } + + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&blobService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + blobContainer := &storage.StorageAccountsBlobServicesContainer{ ObjectMeta: tc.MakeObjectMetaWithName(vulnerabilityAssessmentsContainerName), Spec: storage.StorageAccountsBlobServicesContainer_Spec{ diff --git a/v2/internal/controllers/crd_storage_storageaccount_20210401_test.go b/v2/internal/controllers/storage_storageaccount_crud_20210401_test.go similarity index 95% rename from v2/internal/controllers/crd_storage_storageaccount_20210401_test.go rename to v2/internal/controllers/storage_storageaccount_crud_20210401_test.go index 06e0db8865d..27eaca98af6 100644 --- a/v2/internal/controllers/crd_storage_storageaccount_20210401_test.go +++ b/v2/internal/controllers/storage_storageaccount_crud_20210401_test.go @@ -78,8 +78,10 @@ func StorageAccount_BlobServices_20210401_CRUD(tc *testcommon.KubePerTestContext }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&blobService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(blobService) - // no DELETE, this is not a real resource tc.RunParallelSubtests( testcommon.Subtest{ @@ -109,6 +111,7 @@ func StorageAccount_QueueServices_20210401_CRUD(tc *testcommon.KubePerTestContex Owner: testcommon.AsOwner(storageAccount), }, } + tc.AddAnnotation(&queueService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(queueService) // cannot delete - not a real resource @@ -131,6 +134,9 @@ func StorageAccount_QueueServices_Queue_20210401_CRUD(tc *testcommon.KubePerTest }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&queue.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(queue) defer tc.DeleteResourceAndWait(queue) } diff --git a/v2/internal/controllers/crd_storage_storageaccount_20230101_test.go b/v2/internal/controllers/storage_storageaccount_crud_20230101_test.go similarity index 93% rename from v2/internal/controllers/crd_storage_storageaccount_20230101_test.go rename to v2/internal/controllers/storage_storageaccount_crud_20230101_test.go index 3816a757cff..479449bda15 100644 --- a/v2/internal/controllers/crd_storage_storageaccount_20230101_test.go +++ b/v2/internal/controllers/storage_storageaccount_crud_20230101_test.go @@ -90,8 +90,10 @@ func StorageAccount_BlobServices_CRUD(tc *testcommon.KubePerTestContext, storage }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&blobService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(blobService) - // no DELETE, this is not a real resource tc.RunParallelSubtests( testcommon.Subtest{ @@ -121,6 +123,7 @@ func StorageAccount_QueueServices_CRUD(tc *testcommon.KubePerTestContext, storag Owner: testcommon.AsOwner(storageAccount), }, } + tc.AddAnnotation(&queueService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(queueService) // cannot delete - not a real resource @@ -142,6 +145,7 @@ func StorageAccount_QueueServices_Queue_CRUD(tc *testcommon.KubePerTestContext, Owner: testcommon.AsOwner(queueService), }, } + tc.AddAnnotation(&queueService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") tc.CreateResourceAndWait(queue) defer tc.DeleteResourceAndWait(queue) @@ -155,8 +159,10 @@ func StorageAccount_TableServices_CRUD(tc *testcommon.KubePerTestContext, storag }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&tableService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(tableService) - // no DELETE, this is not a real resource tc.RunParallelSubtests( testcommon.Subtest{ @@ -187,8 +193,10 @@ func StorageAccount_FileServices_CRUD(tc *testcommon.KubePerTestContext, storage }, } + // Don't try to delete directly, this is not a real resource - to delete it you must delete its parent + tc.AddAnnotation(&fileService.ObjectMeta, "serviceoperator.azure.com/reconcile-policy", "detach-on-delete") + tc.CreateResourceAndWait(fileService) - // no DELETE, this is not a real resource tc.RunParallelSubtests( testcommon.Subtest{ diff --git a/v2/internal/reconcilers/arm/azure_generic_arm_reconciler.go b/v2/internal/reconcilers/arm/azure_generic_arm_reconciler.go index e00fff0b1c9..ce025c0caf7 100644 --- a/v2/internal/reconcilers/arm/azure_generic_arm_reconciler.go +++ b/v2/internal/reconcilers/arm/azure_generic_arm_reconciler.go @@ -38,8 +38,9 @@ const ( type DeleteAction string const ( - DeleteActionBeginDelete = DeleteAction("BeginDelete") - DeleteActionMonitorDelete = DeleteAction("MonitorDelete") + DeleteActionBeginDelete = DeleteAction("BeginDelete") + DeleteActionMonitorDelete = DeleteAction("MonitorDelete") + DeleteActionNotPossibleInAzure = DeleteAction("NotPossibleInAzure") ) type ( diff --git a/v2/internal/reconcilers/arm/azure_generic_arm_reconciler_instance.go b/v2/internal/reconcilers/arm/azure_generic_arm_reconciler_instance.go index a0befbfcbf4..698f00b1193 100644 --- a/v2/internal/reconcilers/arm/azure_generic_arm_reconciler_instance.go +++ b/v2/internal/reconcilers/arm/azure_generic_arm_reconciler_instance.go @@ -26,6 +26,7 @@ import ( "github.com/Azure/azure-service-operator/v2/internal/reconcilers/arm/errorclassification" "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" "github.com/Azure/azure-service-operator/v2/internal/resolver" + "github.com/Azure/azure-service-operator/v2/pkg/common/annotations" "github.com/Azure/azure-service-operator/v2/pkg/common/labels" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" @@ -129,6 +130,11 @@ func (r *azureDeploymentReconcilerInstance) DetermineDeleteAction() (DeleteActio return DeleteActionMonitorDelete, r.MonitorDelete, nil } + if !genruntime.ResourceOperationDelete.IsSupportedBy(r.Obj) { + // Resource doesn't support delete; we'll end up returning an actionable error + return DeleteActionNotPossibleInAzure, r.DeleteNotPossibleInAzure, nil + } + return DeleteActionBeginDelete, r.StartDeleteOfResource, nil } @@ -205,6 +211,23 @@ func (r *azureDeploymentReconcilerInstance) MonitorDelete(ctx context.Context) ( return ctrl.Result{Requeue: true, RequeueAfter: retryAfter}, nil } +// DeleteNotPossibleInAzure is used when the underlying Azure resource doesn't support direct deletion, so we return an error. +func (r *azureDeploymentReconcilerInstance) DeleteNotPossibleInAzure(ctx context.Context) (ctrl.Result, error) { + msg := fmt.Sprintf( + "Resource does not support deletion in Azure; set annotation %s: %s to permit deletion in Kubernetes", + annotations.ReconcilePolicy, + annotations.ReconcilePolicyDetachOnDelete) + r.Log.V(Verbose).Info(msg) + r.Recorder.Event(r.Obj, v1.EventTypeNormal, string(DeleteActionNotPossibleInAzure), msg) + + // Return a meaningful error so that the Ready condition is updated to show the user why the resource can't yet be deleted. + return ctrl.Result{}, + conditions.NewReadyConditionImpactingError( + eris.New(msg), + conditions.ConditionSeverityError, + conditions.ReasonDeletionNotSupported) +} + func (r *azureDeploymentReconcilerInstance) BeginCreateOrUpdateResource( ctx context.Context, ) (ctrl.Result, error) { diff --git a/v2/internal/testcommon/kube_per_test_context.go b/v2/internal/testcommon/kube_per_test_context.go index 1f49eb278f3..0d4d55fb8c3 100644 --- a/v2/internal/testcommon/kube_per_test_context.go +++ b/v2/internal/testcommon/kube_per_test_context.go @@ -22,6 +22,7 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" @@ -868,6 +869,20 @@ func (tc *KubePerTestContext) exportAsYAML(resource runtime.Object, filePath str return nil } +func (tc *KubePerTestContext) AddAnnotation( + obj *v1.ObjectMeta, + key string, + value string, +) { + annotations := obj.GetAnnotations() + if annotations == nil { + annotations = make(map[string]string) + } + + annotations[key] = value + obj.SetAnnotations(annotations) +} + type ResourceTracker struct { resources []client.Object } diff --git a/v2/pkg/genruntime/conditions/ready_condition_builder.go b/v2/pkg/genruntime/conditions/ready_condition_builder.go index 6c044a14cc3..0aa18e341ff 100644 --- a/v2/pkg/genruntime/conditions/ready_condition_builder.go +++ b/v2/pkg/genruntime/conditions/ready_condition_builder.go @@ -39,6 +39,7 @@ var ( ReasonReconcileBlocked = Reason{Name: "ReconciliationBlocked", RetryClassification: retry.Slow} ReasonReconcilePostponed = Reason{Name: "ReconciliationPostponed", RetryClassification: retry.Slow} ReasonPostReconcileFailure = Reason{Name: "PostReconciliationFailure", RetryClassification: retry.Slow} + ReasonDeletionNotSupported = Reason{Name: "DeletionNotSupportedInAzure", RetryClassification: retry.None} ) // ReasonFailed is a catch-all error code for when we don't have a more specific error classification diff --git a/v2/samples/dataprotection/v1api20231101/refs/v1api20230101_storageaccountsblobservice.yaml b/v2/samples/dataprotection/v1api20231101/refs/v1api20230101_storageaccountsblobservice.yaml index d312fa3ea4c..a6cca889c98 100644 --- a/v2/samples/dataprotection/v1api20231101/refs/v1api20230101_storageaccountsblobservice.yaml +++ b/v2/samples/dataprotection/v1api20231101/refs/v1api20230101_storageaccountsblobservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsBlobService metadata: name: asodpsamplekubestorageservice namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: asodpsamplekubestorage diff --git a/v2/samples/dbformariadb/v1api/v1api20180601_configuration.yaml b/v2/samples/dbformariadb/v1api/v1api20180601_configuration.yaml index 808b3b5952f..f154e69e8bb 100644 --- a/v2/samples/dbformariadb/v1api/v1api20180601_configuration.yaml +++ b/v2/samples/dbformariadb/v1api/v1api20180601_configuration.yaml @@ -3,6 +3,9 @@ kind: Configuration metadata: name: query_cache_size namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: azureName: query_cache_size owner: diff --git a/v2/samples/dbformysql/v1api20220101/v1api20220101_flexibleserversconfiguration.yaml b/v2/samples/dbformysql/v1api20220101/v1api20220101_flexibleserversconfiguration.yaml index e8b89332497..3f46ec5615a 100644 --- a/v2/samples/dbformysql/v1api20220101/v1api20220101_flexibleserversconfiguration.yaml +++ b/v2/samples/dbformysql/v1api20220101/v1api20220101_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: maxconnections namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplemysql diff --git a/v2/samples/dbformysql/v1api20230630/v1api20230630_flexibleserversconfiguration.yaml b/v2/samples/dbformysql/v1api20230630/v1api20230630_flexibleserversconfiguration.yaml index 956ff9dbf93..06f6c496921 100644 --- a/v2/samples/dbformysql/v1api20230630/v1api20230630_flexibleserversconfiguration.yaml +++ b/v2/samples/dbformysql/v1api20230630/v1api20230630_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: maxconnections namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplemysql diff --git a/v2/samples/dbformysql/v1api20231230/v1api20231230_flexibleserversconfiguration.yaml b/v2/samples/dbformysql/v1api20231230/v1api20231230_flexibleserversconfiguration.yaml index 17a59d9697f..edf3f47b540 100644 --- a/v2/samples/dbformysql/v1api20231230/v1api20231230_flexibleserversconfiguration.yaml +++ b/v2/samples/dbformysql/v1api20231230/v1api20231230_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: maxconnections namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplemysql diff --git a/v2/samples/dbforpostgresql/v1api20210601/v1api20210601_flexibleserversconfiguration.yaml b/v2/samples/dbforpostgresql/v1api20210601/v1api20210601_flexibleserversconfiguration.yaml index 0c08d5b65fa..3f1991dd56c 100644 --- a/v2/samples/dbforpostgresql/v1api20210601/v1api20210601_flexibleserversconfiguration.yaml +++ b/v2/samples/dbforpostgresql/v1api20210601/v1api20210601_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: pgaudit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplepostgresql diff --git a/v2/samples/dbforpostgresql/v1api20220120preview/v1api20220120preview_flexibleserversconfiguration.yaml b/v2/samples/dbforpostgresql/v1api20220120preview/v1api20220120preview_flexibleserversconfiguration.yaml index 1e603d81638..2beb1bac89f 100644 --- a/v2/samples/dbforpostgresql/v1api20220120preview/v1api20220120preview_flexibleserversconfiguration.yaml +++ b/v2/samples/dbforpostgresql/v1api20220120preview/v1api20220120preview_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: pgaudit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplepostgresql diff --git a/v2/samples/dbforpostgresql/v1api20221201/v1api20221201_flexibleserversconfiguration.yaml b/v2/samples/dbforpostgresql/v1api20221201/v1api20221201_flexibleserversconfiguration.yaml index 6abb1dbf6ff..6285dbc17a2 100644 --- a/v2/samples/dbforpostgresql/v1api20221201/v1api20221201_flexibleserversconfiguration.yaml +++ b/v2/samples/dbforpostgresql/v1api20221201/v1api20221201_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: pgaudit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplepostgresql diff --git a/v2/samples/dbforpostgresql/v1api20230601preview/v1api20230601preview_flexibleserversconfiguration.yaml b/v2/samples/dbforpostgresql/v1api20230601preview/v1api20230601preview_flexibleserversconfiguration.yaml index 076d1191e45..629ed734510 100644 --- a/v2/samples/dbforpostgresql/v1api20230601preview/v1api20230601preview_flexibleserversconfiguration.yaml +++ b/v2/samples/dbforpostgresql/v1api20230601preview/v1api20230601preview_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: pgaudit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplepostgresql diff --git a/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversadvancedthreatprotectionsettings.yaml b/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversadvancedthreatprotectionsettings.yaml index 2d377e79d96..43e98a234db 100644 --- a/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversadvancedthreatprotectionsettings.yaml +++ b/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversadvancedthreatprotectionsettings.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersAdvancedThreatProtectionSettings metadata: name: advancedprotection namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: asosampleserver20240801 diff --git a/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversconfiguration.yaml b/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversconfiguration.yaml index 2d52551a509..d21af913b57 100644 --- a/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversconfiguration.yaml +++ b/v2/samples/dbforpostgresql/v1api20240801/v1api20240801_flexibleserversconfiguration.yaml @@ -3,6 +3,9 @@ kind: FlexibleServersConfiguration metadata: name: pgaudit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: asosampleserver20240801 diff --git a/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasecollectionthroughputsetting.yaml b/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasecollectionthroughputsetting.yaml index 0412a7ea2ec..5964a962ed9 100644 --- a/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasecollectionthroughputsetting.yaml +++ b/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasecollectionthroughputsetting.yaml @@ -3,6 +3,9 @@ kind: MongodbDatabaseCollectionThroughputSetting metadata: name: sample-mongo-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent collection + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-mongo-collection diff --git a/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasethroughputsetting.yaml b/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasethroughputsetting.yaml index edb26567fda..404619458b5 100644 --- a/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasethroughputsetting.yaml +++ b/v2/samples/documentdb/mongodb/v1api20210515/v1api20210515_mongodbdatabasethroughputsetting.yaml @@ -3,6 +3,9 @@ kind: MongodbDatabaseThroughputSetting metadata: name: sample-mongo-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-db-mongodb diff --git a/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasecollectionthroughputsetting.yaml b/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasecollectionthroughputsetting.yaml index 964117e955d..3850c1dd4a7 100644 --- a/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasecollectionthroughputsetting.yaml +++ b/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasecollectionthroughputsetting.yaml @@ -3,6 +3,9 @@ kind: MongodbDatabaseCollectionThroughputSetting metadata: name: sample-mongodb-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent collection + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-mongo-collection diff --git a/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasethroughputsetting.yaml b/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasethroughputsetting.yaml index 91c789808b4..1bd1c5de018 100644 --- a/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasethroughputsetting.yaml +++ b/v2/samples/documentdb/mongodb/v1api20231115/v1api20231115_mongodbdatabasethroughputsetting.yaml @@ -3,6 +3,9 @@ kind: MongodbDatabaseThroughputSetting metadata: name: sample-mongodb-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-mongodb diff --git a/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasecollectionthroughputsetting.yaml b/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasecollectionthroughputsetting.yaml index 67fbe1b5ff9..d2e7665093a 100644 --- a/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasecollectionthroughputsetting.yaml +++ b/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasecollectionthroughputsetting.yaml @@ -3,6 +3,9 @@ kind: MongodbDatabaseCollectionThroughputSetting metadata: name: sample-mongodb-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent collection + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-mongo-collection diff --git a/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasethroughputsetting.yaml b/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasethroughputsetting.yaml index fd173f48440..ebe4497f8ae 100644 --- a/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasethroughputsetting.yaml +++ b/v2/samples/documentdb/mongodb/v1api20240815/v1api20240815_mongodbdatabasethroughputsetting.yaml @@ -3,6 +3,9 @@ kind: MongodbDatabaseThroughputSetting metadata: name: sample-mongodb-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-mongodb diff --git a/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasecontainerthroughputsetting.yaml b/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasecontainerthroughputsetting.yaml index c22396a4a26..8f885451891 100644 --- a/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasecontainerthroughputsetting.yaml +++ b/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasecontainerthroughputsetting.yaml @@ -3,6 +3,9 @@ kind: SqlDatabaseContainerThroughputSetting metadata: name: sample-mongo-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-sql-container diff --git a/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasethroughputsetting.yaml b/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasethroughputsetting.yaml index a027749594a..ce5119a0575 100644 --- a/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasethroughputsetting.yaml +++ b/v2/samples/documentdb/sqldatabase/v1api20210515/v1api20210515_sqldatabasethroughputsetting.yaml @@ -3,6 +3,9 @@ kind: SqlDatabaseThroughputSetting metadata: name: sample-sql-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-sql-db diff --git a/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasecontainerthroughputsetting.yaml b/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasecontainerthroughputsetting.yaml index e411c555aba..707f587bd8b 100644 --- a/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasecontainerthroughputsetting.yaml +++ b/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasecontainerthroughputsetting.yaml @@ -3,6 +3,9 @@ kind: SqlDatabaseContainerThroughputSetting metadata: name: sample-mongo-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-sql-container diff --git a/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasethroughputsetting.yaml b/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasethroughputsetting.yaml index 9d075063d10..0025530ddec 100644 --- a/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasethroughputsetting.yaml +++ b/v2/samples/documentdb/sqldatabase/v1api20231115/v1api20231115_sqldatabasethroughputsetting.yaml @@ -3,6 +3,9 @@ kind: SqlDatabaseThroughputSetting metadata: name: sample-sql-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-sql-db diff --git a/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasecontainerthroughputsetting.yaml b/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasecontainerthroughputsetting.yaml index b897f0992bb..5fccc8a8a37 100644 --- a/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasecontainerthroughputsetting.yaml +++ b/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasecontainerthroughputsetting.yaml @@ -3,6 +3,9 @@ kind: SqlDatabaseContainerThroughputSetting metadata: name: sample-mongo-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-sql-container diff --git a/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasethroughputsetting.yaml b/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasethroughputsetting.yaml index b946f587e8d..52ee4268f9d 100644 --- a/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasethroughputsetting.yaml +++ b/v2/samples/documentdb/sqldatabase/v1api20240815/v1api20240815_sqldatabasethroughputsetting.yaml @@ -3,6 +3,9 @@ kind: SqlDatabaseThroughputSetting metadata: name: sample-sql-throughput namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: sample-sql-db diff --git a/v2/samples/eventgrid/v1api/refs/v1api20210401_storageaccountsqueueservice.yaml b/v2/samples/eventgrid/v1api/refs/v1api20210401_storageaccountsqueueservice.yaml index f9ee0018c25..93ab54877b0 100644 --- a/v2/samples/eventgrid/v1api/refs/v1api20210401_storageaccountsqueueservice.yaml +++ b/v2/samples/eventgrid/v1api/refs/v1api20210401_storageaccountsqueueservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsQueueService metadata: name: samplekubestoragequeuesalpha namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestoragealpha diff --git a/v2/samples/insights/v1api/v1api20171001_pricingplan.yaml b/v2/samples/insights/v1api/v1api20171001_pricingplan.yaml index 437bc435701..193658cf7ad 100644 --- a/v2/samples/insights/v1api/v1api20171001_pricingplan.yaml +++ b/v2/samples/insights/v1api/v1api20171001_pricingplan.yaml @@ -3,6 +3,9 @@ kind: PricingPlan metadata: name: aso-sample-pricingplan namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent component + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: cap: 1.0 owner: diff --git a/v2/samples/sql/v1api20211101/refs/v1api20210401_storageaccountsblobservice.yaml b/v2/samples/sql/v1api20211101/refs/v1api20210401_storageaccountsblobservice.yaml index acfb20c1c5a..304587ea947 100644 --- a/v2/samples/sql/v1api20211101/refs/v1api20210401_storageaccountsblobservice.yaml +++ b/v2/samples/sql/v1api20211101/refs/v1api20210401_storageaccountsblobservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsBlobService metadata: name: sqlstorageservice namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent storage account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: asotestsqlstorageref diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversadvancedthreatprotectionsetting.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversadvancedthreatprotectionsetting.yaml index ba30b0aecc8..e210b50e20b 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversadvancedthreatprotectionsetting.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversadvancedthreatprotectionsetting.yaml @@ -3,6 +3,9 @@ kind: ServersAdvancedThreatProtectionSetting metadata: name: aso-sample-atp namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-sqlserver diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversauditingsetting.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversauditingsetting.yaml index 744f8a24842..bdb48bb6233 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversauditingsetting.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversauditingsetting.yaml @@ -3,6 +3,9 @@ kind: ServersAuditingSetting metadata: name: aso-sample-audit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-sqlserver diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversconnectionpolicy.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversconnectionpolicy.yaml index 5b7be6999a2..1f0feff3d67 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversconnectionpolicy.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversconnectionpolicy.yaml @@ -3,6 +3,9 @@ kind: ServersConnectionPolicy metadata: name: aso-sample-connpolicy namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent server + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-sqlserver diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesadvancedthreatprotectionsetting.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesadvancedthreatprotectionsetting.yaml index 4a96e10b81b..36e82f6f745 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesadvancedthreatprotectionsetting.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesadvancedthreatprotectionsetting.yaml @@ -3,6 +3,9 @@ kind: ServersDatabasesAdvancedThreatProtectionSetting metadata: name: aso-sample-atp namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-db diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesauditingsetting.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesauditingsetting.yaml index bbf61b7dbb3..ac7baaaff0f 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesauditingsetting.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesauditingsetting.yaml @@ -3,6 +3,9 @@ kind: ServersDatabasesAuditingSetting metadata: name: aso-sample-audit namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-db diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackuplongtermretentionpolicy.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackuplongtermretentionpolicy.yaml index 09438b85cc8..f325bf8f032 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackuplongtermretentionpolicy.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackuplongtermretentionpolicy.yaml @@ -3,6 +3,9 @@ kind: ServersDatabasesBackupLongTermRetentionPolicy metadata: name: aso-sample-longterm-backup-policy namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-db diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackupshorttermretentionpolicy.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackupshorttermretentionpolicy.yaml index 2adaec66d20..6445fc0c303 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackupshorttermretentionpolicy.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasesbackupshorttermretentionpolicy.yaml @@ -3,6 +3,9 @@ kind: ServersDatabasesBackupShortTermRetentionPolicy metadata: name: aso-sample-shortterm-backup-policy namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-db diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasessecurityalertpolicy.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasessecurityalertpolicy.yaml index c3f462cd2ce..a91f8802c78 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasessecurityalertpolicy.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasessecurityalertpolicy.yaml @@ -3,6 +3,9 @@ kind: ServersDatabasesSecurityAlertPolicy metadata: name: aso-sample-alertpolicy namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-db diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasestransparentdataencryption.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasestransparentdataencryption.yaml index ed1249f9148..6f35414b8cc 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasestransparentdataencryption.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serversdatabasestransparentdataencryption.yaml @@ -3,6 +3,9 @@ kind: ServersDatabasesTransparentDataEncryption metadata: name: aso-sample-encrypt namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-db diff --git a/v2/samples/sql/v1api20211101/v1api20211101_serverssecurityalertpolicy.yaml b/v2/samples/sql/v1api20211101/v1api20211101_serverssecurityalertpolicy.yaml index ee17dc71fc8..2e73b978ca0 100644 --- a/v2/samples/sql/v1api20211101/v1api20211101_serverssecurityalertpolicy.yaml +++ b/v2/samples/sql/v1api20211101/v1api20211101_serverssecurityalertpolicy.yaml @@ -3,6 +3,9 @@ kind: ServersSecurityAlertPolicy metadata: name: aso-sample-alertpolicy namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent database + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: aso-sample-sqlserver diff --git a/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsblobservice.yaml b/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsblobservice.yaml index 48aa8740575..919ecf198da 100644 --- a/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsblobservice.yaml +++ b/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsblobservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsBlobService metadata: name: samplekubestorageservice namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestorage diff --git a/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsqueueservice.yaml b/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsqueueservice.yaml index a1a7bf15add..e8c0cc1ae2b 100644 --- a/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsqueueservice.yaml +++ b/v2/samples/storage/v1api20210401/v1api20210401_storageaccountsqueueservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsQueueService metadata: name: samplekubestoragequeues namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestorage diff --git a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsblobservice.yaml b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsblobservice.yaml index 3028bae83a6..166240c2c57 100644 --- a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsblobservice.yaml +++ b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsblobservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsBlobService metadata: name: samplekubestorageservice namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestorage diff --git a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsfileservice.yaml b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsfileservice.yaml index fc04db4ad6b..3c07e33a170 100644 --- a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsfileservice.yaml +++ b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsfileservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsFileService metadata: name: samplekubestoragefile namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplestorageaccount diff --git a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsqueueservice.yaml b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsqueueservice.yaml index b6d6058cde5..b9aa6b17c29 100644 --- a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsqueueservice.yaml +++ b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountsqueueservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsQueueService metadata: name: samplekubestoragequeues namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestorage diff --git a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountstableservice.yaml b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountstableservice.yaml index 38da45f1581..1c9ff0d0e19 100644 --- a/v2/samples/storage/v1api20220901/v1api20220901_storageaccountstableservice.yaml +++ b/v2/samples/storage/v1api20220901/v1api20220901_storageaccountstableservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsTableService metadata: name: samplekubestoragetable namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplestorageaccount diff --git a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsblobservice.yaml b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsblobservice.yaml index 20535d3f4a9..bce2aa2e9c7 100644 --- a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsblobservice.yaml +++ b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsblobservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsBlobService metadata: name: samplekubestorageservice namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestorage diff --git a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsfileservice.yaml b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsfileservice.yaml index b2b8da7d7ef..d038cd1d673 100644 --- a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsfileservice.yaml +++ b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsfileservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsFileService metadata: name: samplekubestoragefile namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplestorageaccount diff --git a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsqueueservice.yaml b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsqueueservice.yaml index 0e18489d256..289cb19708a 100644 --- a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsqueueservice.yaml +++ b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountsqueueservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsQueueService metadata: name: samplekubestoragequeues namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplekubestorage diff --git a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountstableservice.yaml b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountstableservice.yaml index 19641cb8cb0..bc10b9c4259 100644 --- a/v2/samples/storage/v1api20230101/v1api20230101_storageaccountstableservice.yaml +++ b/v2/samples/storage/v1api20230101/v1api20230101_storageaccountstableservice.yaml @@ -3,6 +3,9 @@ kind: StorageAccountsTableService metadata: name: samplekubestoragetable namespace: default + annotations: + # Can't be directly deleted in Azure, only by deleting the parent account + serviceoperator.azure.com/reconcile-policy: detach-on-delete spec: owner: name: samplestorageaccount