Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch Bicep Recipe deletion logic from sequential to parallel and ad…
…d retries (#6256) # Description Continuation of #6069 * Changing Recipe BicepDriver deletion logic to be parallel with retries * Changing Recipe GCResources to use Driver delete ## Type of change <!-- Please select **one** of the following options that describes your change and delete the others. Clearly identifying the type of change you are making will help us review your PR faster, and is used in authoring release notes. If you are making a bug fix or functionality change to Radius and do not have an associated issue link please create one now. --> - This pull request fixes a bug in Radius and has an approved issue (issue link required). <!-- Please update the following to link the associated issue. This is required for some kinds of changes (see above). --> Fixes: #5294 ## Auto-generated summary <!-- GitHub Copilot for docs will auto-generate a summary of the PR --> <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at 33c5342</samp> ### Summary 🚀🧪🛠️ <!-- 1. 🚀 - This emoji represents the performance and scalability improvements for the worker server and the bicep driver, as well as the use of the armresources package and the AWS credentials client. 2. 🧪 - This emoji represents the addition of unit tests for the sdk package and the bicep driver, as well as the use of gomock and time packages for testing. 3. 🛠️ - This emoji represents the bug fixes and enhancements for the configmaps, the documentation, the factory, the database timeouts, and the error handling. --> This pull request updates various files in the radius project to use the NewClientOptions function with a nil parameter, improve the bicep driver, increase the worker server concurrency, and fix the radius secret. It also adds a new dependency, updates the documentation, and adds unit tests. > _This pull request has many changes_ > _To improve the worker ranges_ > _It adds some retry_ > _And merges structs neatly_ > _And updates the client options for stages_ ### Walkthrough * Increase the maximum operation concurrency for the worker server from 3 to 10 in various configuration files and update the documentation accordingly ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-5b57e9314a18299dc316a8cfec855ae859078a6b3baaf8a9d9205f4d1e26e665L30-R30), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-a9312f9d13becb76eeb2cba6b9a0f78cc182ae1c203e3f3db5899f3aec534940L40-R40), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-cdbd007d23572be9425f931432181ce0b9468a548a9c28999d0943277a424c7bL36-R36), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-9976f6e926619046569a25ece5f0cd16adfe3413b6334097c6f736e83cda58caL30-R30), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-4df28288cb6f2d9e8e1c520e2a82d7382058acaeebae8882c92b1634882efc43L40-R40), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-58d6d96c3a9a74e33fc72e9a458a3e9f4c463287d906985725fddb0398081126L40-R40), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-58d6d96c3a9a74e33fc72e9a458a3e9f4c463287d906985725fddb0398081126L86-R86), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-c5a6e900bac29ec26476b731e62862ee9afb8f9f67225da0aa8fd1d052f8183fL99-R99), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-c5a6e900bac29ec26476b731e62862ee9afb8f9f67225da0aa8fd1d052f8183fL212-R212)) * Add a new dependency to the `go.mod` file to use the mergo package for merging structs in the `sdk` package ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6R98)) * Add a new parameter to the `NewClientOptions` function in the `pipeline.go` file to allow passing a custom `clientOptions` struct and implement the logic for merging it with the default options using the mergo package ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-9817c1a3a0f4fe01748698c7f17bcce4346f3baebdbb4e731fa2bd9cd54a4113R22), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-9817c1a3a0f4fe01748698c7f17bcce4346f3baebdbb4e731fa2bd9cd54a4113L40-R48), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-9817c1a3a0f4fe01748698c7f17bcce4346f3baebdbb4e731fa2bd9cd54a4113R70-R80)) * Add unit tests for the `NewClientOptions` function in the `pipeline_test.go` file ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-15e4a018a66c77b12fbf73c7d29edd2fbfa87807fd0b65475ee29caf5bf8c3e9R1-R103)) * Add a new parameter to the `NewClientOptions` function calls in various packages to pass a nil `clientOptions` struct, which will use the default options for creating different clients ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-d4132acf041f5a0725d02f79003aca9ad44bc2829ec159cb704b927f13d7b916L71-R71), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-d4132acf041f5a0725d02f79003aca9ad44bc2829ec159cb704b927f13d7b916L134-R134), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-d4132acf041f5a0725d02f79003aca9ad44bc2829ec159cb704b927f13d7b916L187-R187), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-d4132acf041f5a0725d02f79003aca9ad44bc2829ec159cb704b927f13d7b916L209-R209), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-5d6b976ca1401aa4b4ea6fdaf8142700ada0d6ddd9690bb7eed8797f91d33466L117-R122), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-7ea25eedbaa97be92839b34529ce6c828e50f74b8845eaefc02832c23cd6d833L61-R61), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-2779f210632b96e2b7717b9cfae7f667d7f8f5d4053a67d9e796c00d39e34ce1L80-R80), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-ba263c7aa6158e7fdb51e32b1e42473d51fe6dbba4cd83b78bd0291d0465d629L171-R180), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-33881a33475ba368a26aee51ed3c9840f6af46e31f5535106506e6303729f6e3L43-R43)) * Increase the timeout values for async create or update and delete operations for Mongo and SQL databases in the `datastoresrp` package to accommodate the longer time required for these operations in AWS ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-59a31913465fb9882e5a2daa03bb09e235cee7c6b313dbf62f11369427b3069dL28-R30), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-59a31913465fb9882e5a2daa03bb09e235cee7c6b313dbf62f11369427b3069dL43-R45)) * Add a new import, constants, and a helper function to the `resourceclient.go` file in the `portableresources` package to use the `armresourcesv1` package for defining error codes and details for AWS operations and checking if an error is retryable ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-ba263c7aa6158e7fdb51e32b1e42473d51fe6dbba4cd83b78bd0291d0465d629R26), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-ba263c7aa6158e7fdb51e32b1e42473d51fe6dbba4cd83b78bd0291d0465d629R45-R51), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-ba263c7aa6158e7fdb51e32b1e42473d51fe6dbba4cd83b78bd0291d0465d629R269-R272)) * Add a new field, constant, and import to the `bicep.go` file in the `recipes` package to pass a default retry config to the bicep driver and use the time package for defining the retry delay ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L27-R29), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0R51-R52), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0R63), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0R71)) * Add a new file `retry.go` to the `recipes` package to define the `RetryConfig` type and the `NewDefaultRetryConfig` function for the bicep driver ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-50fbb436c8d21092902b891817b78b2c53d6a2f34710380a61c89c9d7d00b6b6R1-R41)) * Refactor the logic for deleting output resources in the `bicep.go` file in the `recipes` package to use goroutines, errgroup, and retry logic based on the retry config and the retryable error codes ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L157-R219)) * Update the `Mode` field in the `DeploymentProperties` struct and the type of the `resources` parameter in the `prepareRecipeResponse` function in the `bicep.go` file in the `recipes` package to use the `armresources` package instead of the `deployments` package ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L119-R124), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L289-R326)) * Refactor the logic for deleting obsolete output resources in the `Execute` function of the `bicep.go` file in the `recipes` package to use the `Delete` function instead of the `deleteGCOutputResources` function and convert the resource IDs to output resources with parsed IDs ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L147-R166)) * Remove the `deleteGCOutputResources` function and the test cases for it from the `bicep.go` and `bicep_test.go` files in the `recipes` package, since they are no longer used after the refactoring of the `Delete` function ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-f12e37706fa75e9e04b8dfa01a45cf9bf2a0463e1962605b2420d0cb343922a0L342-L355), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-a0a208a111e71713a21b404fdb3b31fd13f668e5716ab4331584027cc3d98debL483-R518)) * Update the `Delete` function calls in the test cases in the `bicep_test.go` file in the `recipes` package to use `gomock.Any()` instead of `ctx` for the first argument, since the context is not relevant for the mock expectation ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-a0a208a111e71713a21b404fdb3b31fd13f668e5716ab4331584027cc3d98debL393-R397), [link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-a0a208a111e71713a21b404fdb3b31fd13f668e5716ab4331584027cc3d98debL422-R426)) * Add a new field to the `setupDeleteInputs` function call in the `bicep_test.go` file in the `recipes` package to pass a retry config to the bicep driver test ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-a0a208a111e71713a21b404fdb3b31fd13f668e5716ab4331584027cc3d98debR362-R365)) * Add a new import to the `bicep_test.go` file in the `recipes` package to use the time package for defining the retry delay in the bicep driver test ([link](https://github.com/radius-project/radius/pull/6256/files?diff=unified&w=0#diff-a0a208a111e71713a21b404fdb3b31fd13f668e5716ab4331584027cc3d98debL20-R22)) --------- Co-authored-by: Karishma Chawla <[email protected]>
- Loading branch information