Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'manual' provisioning to containers (#6423)
# Description This change adds 'manual' provisioning mode to containers, this means that a container can have the setting `resourceProvisioning: 'manual'` which means that Radius won't create any resources. This also includes the ability to specify `resources: ...` to denote the existing resources associated with the container. This will be used by the new Kubernetes integration that needs to *track* the existance of a container without deploying it. ## Type of change - This pull request adds or changes features of Radius and has an approved issue (issue link required). ## Auto-generated summary <!-- GitHub Copilot for docs will auto-generate a summary of the PR --> <!-- copilot:all --> ### <samp>🤖 Generated by Copilot at fce2fbf</samp> ### Summary 🐳🛠️🧪 <!-- 1. 🐳 - This emoji represents a container or a whale, and it can be used to indicate the changes related to container resources and their provisioning. 2. 🛠️ - This emoji represents a tool or a hammer and wrench, and it can be used to indicate the changes related to adding or modifying code, functions, types, or schemas. 3. 🧪 - This emoji represents a test or a test tube, and it can be used to indicate the changes related to adding or updating tests or assertions. --> This pull request adds support for manual resource provisioning for containers in the radius project. It introduces new fields, types, and schemas to the `v20231001preview` API version, the `datamodel` package, and the `typespec` folder. It also updates the `corerp` package, the `swagger` specification, and the test files to handle the new feature. It adds conditional logic to the `handlers` and `renderers` packages to skip creating or rendering resources that are manually provisioned. > _To manage containers with ease_ > _We added some new fields and keys_ > _`resourceProvisioning` and `resources`_ > _Are part of the `ContainerProperties`_ > _And they help us reference and create with APIs_ ### Walkthrough * Add support for manual resource provisioning for containers ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-c019a02a8a768b2eec23949592ff1e7b5a167de082059261b3c3372e2870dacaL136-R139),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-c019a02a8a768b2eec23949592ff1e7b5a167de082059261b3c3372e2870dacaL261-R267),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-c019a02a8a768b2eec23949592ff1e7b5a167de082059261b3c3372e2870dacaR555-R589),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbR59-R63),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbR87-R93),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbL121-R149),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbL165-R183),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-fe08aa1da384f35b2b045ae14ccfeef240b4feb9f65363e29c882a9b1718845eL1-R16),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-d98390d94414de84ab52d6bd92ff16d9a6643ca92e366d025a07d9c3b3e63e4aL1-R35),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-07cd8284519deaa5e625f1fe393cb48bdd1cc621c9a4656ca43cc6049dfe7962R68-R87),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR303-R308),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR381-R386),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR1387-R1392),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R624-R625),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R661-R666),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R803-R804),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R836-R841),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R3274-R3300),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-5275155acd7f7a59f0301cfc95f8dd38f72f22795e3197c6a150bae13dd5d5f3L74-R80),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-5275155acd7f7a59f0301cfc95f8dd38f72f22795e3197c6a150bae13dd5d5f3R138-R141),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-033dc8a7c9b970cc30f7420ce8cf2f12a26258b276779683ba3f761c481bf0a7R81-R86),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-3da981bf20df07918a646eafcd867d6c95abac1f3aef1ed1b50a29f3f4cc8636R36),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-3da981bf20df07918a646eafcd867d6c95abac1f3aef1ed1b50a29f3f4cc8636R169-R183),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-3da981bf20df07918a646eafcd867d6c95abac1f3aef1ed1b50a29f3f4cc8636L204),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-6f1219f263ab06a1493ac76960e2ab8cbe647e83e926bff7d13988f393334f94R25),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-6f1219f263ab06a1493ac76960e2ab8cbe647e83e926bff7d13988f393334f94R401-R435),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-a2ffa8fdf3e7cacf68f61fdc82a345456a27dd04bb95d914b1194454b00d1c0aR81-R85),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-99efabd56bb5d297b7f40c7c9958b4b11139710d7149e713ab6ac662d1546cb4R75-R79),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R2953-R2963),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R3015-R3038),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R3091-R3101),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R4637-R4649),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-2f8e96d0546ae7b99ee68e516a354825696d77ca06e49bb6f82ab1caaa778522L65-R83)) * Add new fields `ResourceProvisioning` and `Resources` to the `ContainerProperties` and `ContainerResourceUpdateProperties` structs in the `v20231001preview` and `datamodel` packages ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-c019a02a8a768b2eec23949592ff1e7b5a167de082059261b3c3372e2870dacaL136-R139),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-c019a02a8a768b2eec23949592ff1e7b5a167de082059261b3c3372e2870dacaL261-R267),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR303-R308),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR381-R386),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-5275155acd7f7a59f0301cfc95f8dd38f72f22795e3197c6a150bae13dd5d5f3L74-R80)) * Add new type `ContainerResourceProvisioning` as an enum that specifies how the container resource is managed in the `v20231001preview` package and the `typespec` folder ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-07cd8284519deaa5e625f1fe393cb48bdd1cc621c9a4656ca43cc6049dfe7962R68-R87),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-2f8e96d0546ae7b99ee68e516a354825696d77ca06e49bb6f82ab1caaa778522L65-R83)) * Add new type `ResourceReference` as a struct that describes a reference to an existing resource in the `v20231001preview` and `datamodel` packages and the `swagger` folder ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-21034b9d798fa570ecae4b7d54142c7f94d9d0f1b39c5f45f0c4c859674b19fbR1387-R1392),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-5275155acd7f7a59f0301cfc95f8dd38f72f22795e3197c6a150bae13dd5d5f3R138-R141),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R4637-R4649)) * Add new helper functions to convert between the `ResourceReference` and `ContainerResourceProvisioning` types in the `v20231001preview` and `datamodel` packages ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-c019a02a8a768b2eec23949592ff1e7b5a167de082059261b3c3372e2870dacaR555-R589)) * Add new test cases to the `TestContainerConvertVersionedToDataModel` and `TestContainerConvertDataModelToVersioned` functions in the `container_conversion_test.go` file using the `containerresource-manual.json` and `containerresourcedatamodel-manual.json` files as test inputs ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbR59-R63),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbR87-R93),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbL121-R149),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbL165-R183),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-fe08aa1da384f35b2b045ae14ccfeef240b4feb9f65363e29c882a9b1718845eL1-R16),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-d98390d94414de84ab52d6bd92ff16d9a6643ca92e366d025a07d9c3b3e63e4aL1-R35)) * Add JSON marshalling and unmarshalling logic for the `ResourceProvisioning` and `Resources` fields in the `zz_generated_models_serde.go` file ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R624-R625),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R661-R666),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R803-R804),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R836-R841),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-bc1502ced9e29d6d61dc028d22603e863f59a981bbc54a59879ba3177d8e62e9R3274-R3300)) * Add new properties `resourceProvisioning` and `resources` to the `ContainerProperties` and `ContainerResourceUpdateProperties` schemas in the `openapi.json` file and reference the `ContainerResourceProvisioning` and `ResourceReference` schemas ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R2953-R2963),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R3015-R3038),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-ac35cdfa65680d5d2be2d0513a686f4651b9a41eb951d05dcd446bc927090d68R3091-R3101)) * Add new function `Test_Render_Manual` to the `render_test.go` file in the `container` package to test the `Render` function with a container resource with manual provisioning and a resource reference ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-6f1219f263ab06a1493ac76960e2ab8cbe647e83e926bff7d13988f393334f94R25),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-6f1219f263ab06a1493ac76960e2ab8cbe647e83e926bff7d13988f393334f94R401-R435)) * Modify the `Render` function in the `render.go` file in the `container` package to populate the `outputResources` variable with the `Resources` field in the `ContainerProperties` struct and skip the creation of the container resource if the `ResourceProvisioning` field is `manual` ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-3da981bf20df07918a646eafcd867d6c95abac1f3aef1ed1b50a29f3f4cc8636R36),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-3da981bf20df07918a646eafcd867d6c95abac1f3aef1ed1b50a29f3f4cc8636R169-R183),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-3da981bf20df07918a646eafcd867d6c95abac1f3aef1ed1b50a29f3f4cc8636L204)) * Modify the `Render` function in the `kubernetes.go` file in the `handlers` package to return an empty map of computed values and no error if the `CreateResource` field in the `RenderOptions` struct is nil ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-033dc8a7c9b970cc30f7420ce8cf2f12a26258b276779683ba3f761c481bf0a7R81-R86)) * Modify the `Render` function in the `renderer.go` file in the `daprextension` package and the `render.go` file in the `kubernetesmetadata` package to skip the iteration and continue with the next output resource if the `CreateResource` field in the `OutputResource` struct is nil ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-a2ffa8fdf3e7cacf68f61fdc82a345456a27dd04bb95d914b1194454b00d1c0aR81-R85),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-99efabd56bb5d297b7f40c7c9958b4b11139710d7149e713ab6ac662d1546cb4R75-R79)) * Refactor the test code in the `container_conversion_test.go` file ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbR124),[link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbL154-R177)) * Remove the `emptyExt` field from the test cases in the `TestContainerConvertDataModelToVersioned` function as it is no longer needed ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbR124)) * Replace the `r` variable with the `versioned` variable in the `TestContainerConvertDataModelToVersioned` function for clarity ([link](https://github.com/radius-project/radius/pull/6423/files?diff=unified&w=0#diff-4183e8fa58766ff3187ebf888b8266b181dd6b4f11a23debac68833bde480edbL154-R177))
- Loading branch information