Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for template kind in Environment Recipe schema #5575

Merged
merged 7 commits into from
May 19, 2023

Conversation

kachawla
Copy link
Contributor

@kachawla kachawla commented May 18, 2023

Description

With the addition of Terraform (and other formats in the future), we need a signal from the user to be able to differentiate what type does the recipe belong to. Adding a new field TemplateKind in Env Recipe properties.

Initial review of this field was done as a part of, open to feedback if there are questions/inputs on the naming choice here.
https://microsoft.sharepoint.com/:w:/r/teams/radiuscoreteam/_layouts/15/Doc.aspx?sourcedoc=%7B0F69ADC3-A8F8-4EDC-8215-841C00B68897%7D&file=2023-04%20Radius%20Tech%20Review%20-%20Recipes%20Grab-bag.docx&nav=eyJjIjo2NzAyMTY5MTN9&action=default&mobileredirect=true&share=IQHDrWkP-KjcToIVhBwAtoiXAVD5zjtUgyIJQusNjp-HGko&cid=dae1bb79-1ea9-44ea-8a47-dff69d5091c0

Issue reference

Fixes Support multiple template types user story under https://github.com/project-radius/radius/issues/4446.

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Adds necessary unit tests for change
  • Adds necessary E2E tests for change -- Will update existing tests after bicep update is merged
  • Unit tests passing
  • Extended the documentation / Created issue for it -- Created issue

@kachawla kachawla requested review from rynowak and AaronCrawfis May 18, 2023 17:07
@kachawla kachawla requested a review from a team as a code owner May 18, 2023 17:07
@github-actions
Copy link

You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.

  • Swagger changes require reference edge docs to be updated here
  • Make sure to create a branch and submit a PR into the edge branch instead of the default latest branch, as the swagger changes will not be available until the next release.

For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/.

@github-actions
Copy link

github-actions bot commented May 18, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository project-radius/radius
Commit ref 6142e4f
Unique ID e57fe873c0
Image tag pr-e57fe873c0
Click here to see the list of tools in the current test run
  • KinD: v0.18.0
  • Dapr: 1.10.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.0.0
  • recipe location radiusdev.azurecr.io/test/functional/corerp/recipes/<name>:pr-e57fe873c0
  • appcore-rp test image location: radiusdev.azurecr.io/appcore-rp:pr-e57fe873c0
  • ucp test image location: radiusdev.azurecr.io/ucpd:pr-e57fe873c0

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting samples functional tests...
⌛ Starting corerp functional tests...
⌛ Starting ucp functional tests...
❌ Test tool installation for samples failed. Please check the logs for more details
❌ Failed to install Radius for samples functional test. Please check the logs for more details
❌ samples functional test failed. Please check the logs for more details

@@ -479,6 +480,10 @@
"EnvironmentRecipeProperties": {
"description": "Properties of a Recipe linked to an Environment.",
"properties": {
"templateKind": {
Copy link
Contributor Author

@kachawla kachawla May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to mark it as required in a separate PR after bicep is updated. @AaronCrawfis @rynowak, does it sound good if we add this as a required field in the upcoming release? (users will have to update their existing templates)

Not adding an enum just yet, since we do want to use this field to test terraform, without officially exposing it to users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah either way users will need to update their templates, so I'm good with making this optional for now and then changing it to required in a future PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks! Will also include templateKind in Recipe commands after this PR and bicep is merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Agree that this needs to become required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the PR - #5580

@kachawla kachawla requested a review from vishwahiremat May 18, 2023 17:17
@github-actions
Copy link

github-actions bot commented May 18, 2023

Test Results

2 703 tests  +1   2 696 ✔️ +1   1m 55s ⏱️ ±0s
   242 suites ±0          7 💤 ±0 
       1 files   ±0          0 ±0 

Results for commit 2fb419b. ± Comparison against base commit 5824e84.

This pull request removes 2 and adds 3 tests. Note that renamed tests count towards both.
github.com/project-radius/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/7f639983-a4d2-4f28-96ab-cfc6c8ecc61b
github.com/project-radius/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/7f639983-a4d2-4f28-96ab-cfc6c8ecc61b#01
github.com/project-radius/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/c05ab2b2-5fd0-46f5-9c66-bd611af213ec
github.com/project-radius/radius/pkg/armrpc/frontend/controller ‑ TestValidateEtag_IfMatch/c05ab2b2-5fd0-46f5-9c66-bd611af213ec#01
github.com/project-radius/radius/pkg/corerp/api/v20220315privatepreview ‑ TestConvertVersionedToDataModel/environmentresource-invalid-templatekind.json

♻️ This comment has been updated with latest results.

@github-actions
Copy link

63.9

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 63.9 %
  • main branch coverage: 63.9 %
  • diff coverage: 0 %

The coverage result does not include the functional test coverage.

@github-actions
Copy link

You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.

  • Swagger changes require reference edge docs to be updated here
  • Make sure to create a branch and submit a PR into the edge branch instead of the default latest branch, as the swagger changes will not be available until the next release.

For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/.

@github-actions
Copy link

github-actions bot commented May 18, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository project-radius/radius
Commit ref 0ce3b99
Unique ID 26998b49f0
Image tag pr-26998b49f0
Click here to see the list of tools in the current test run
  • KinD: v0.18.0
  • Dapr: 1.10.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.0.0
  • recipe location radiusdev.azurecr.io/test/functional/corerp/recipes/<name>:pr-26998b49f0
  • appcore-rp test image location: radiusdev.azurecr.io/appcore-rp:pr-26998b49f0
  • ucp test image location: radiusdev.azurecr.io/ucpd:pr-26998b49f0

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp functional tests...
⌛ Starting samples functional tests...
❌ Test tool installation for samples failed. Please check the logs for more details
❌ Failed to install Radius for samples functional test. Please check the logs for more details
❌ samples functional test failed. Please check the logs for more details

@github-actions
Copy link

63.9

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 63.9 %
  • main branch coverage: 63.9 %
  • diff coverage: 0 %

The coverage result does not include the functional test coverage.

@kachawla kachawla force-pushed the kachawla/recipe-templatekind branch from 0ce3b99 to 2ef9ec2 Compare May 18, 2023 19:53
@github-actions
Copy link

You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.

  • Swagger changes require reference edge docs to be updated here
  • Make sure to create a branch and submit a PR into the edge branch instead of the default latest branch, as the swagger changes will not be available until the next release.

For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/.

@github-actions
Copy link

github-actions bot commented May 18, 2023

Radius functional test overview

🔍 Go to test action run

Name Value
Repository project-radius/radius
Commit ref 2ef9ec2
Unique ID 3e575eb2af
Image tag pr-3e575eb2af
Click here to see the list of tools in the current test run
  • KinD: v0.18.0
  • Dapr: 1.10.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.0.0
  • recipe location radiusdev.azurecr.io/test/functional/corerp/recipes/<name>:pr-3e575eb2af
  • appcore-rp test image location: radiusdev.azurecr.io/appcore-rp:pr-3e575eb2af
  • ucp test image location: radiusdev.azurecr.io/ucpd:pr-3e575eb2af

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
❌ Test recipe publishing failed

@github-actions
Copy link

63.9

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 63.9 %
  • main branch coverage: 63.9 %
  • diff coverage: 0 %

The coverage result does not include the functional test coverage.

"templateKind": {
"description": "Format of the template provided by the recipe. Allowed values: bicep",
"type": "string"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it better to make it an enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes eventually, added some details on why not in this comment here #5575 (comment).

Mainly keeping it open ended right so that we can test Terraform before it is fully integrated and available for users.

pkg/recipes/types.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ytimocin ytimocin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (Do we need to add more tests for TemplateKindTerraform?)

@@ -403,11 +404,13 @@ var mockgetDevRecipes = func(ctx context.Context) (map[string]map[string]datamod
recipes := map[string]map[string]datamodel.EnvironmentRecipeProperties{
linkrp.RedisCachesResourceType: {
"redis-kubernetes": {
TemplateKind: recipes.TemplateKindBicep,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for TemplateKindTerraform?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for dev recipes?

"templatePath": "br:sampleregistry.azureacr.io/radius/recipes/mongo"
}
},
"Applications.Link/redisCaches":{
"redis-recipe": {
"linkType": "Applications.Link/redisCaches",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@vishwahiremat
Copy link
Contributor

Are we adding CLI changes in a different PR?

@shalabhms
Copy link
Contributor

shalabhms commented May 18, 2023

@kachawla , you might need to remove ADO issue reference and just reference the main GH issue and call out the changes as part of the feature since we do not have GH issues for tasks. Also we need to remove reference to internal SharePoint team docs. @AaronCrawfis , please confirm on this internal references for GH issue and guidance if any.

@@ -112,7 +112,7 @@ func getRecipeDefinition(environment *v20220315privatepreview.EnvironmentResourc
}

return &recipes.Definition{
Driver: recipes.DriverBicep,
Driver: *found.TemplateKind,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. This is pre-existing and not related to this PR but seems like this is actually kind of driver than "driver" itself. This would require changes to references. cc @vishwahiremat

Suggested change
Driver: *found.TemplateKind,
DriverKind: *found.TemplateKind,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow. Can you elaborate a bit more? If you are interested in how it is integrated and consumed for multiple drivers, you can look at this PR #5533 (this PR is not ready for review, so I'm not expecting feedback on syntax and structure there).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this is actually kind of driver than "driver" itself - current recipes.DriverBicep is not Driver as well, it is a string which defines the type the driver belongs, so we aren't changing anything fundamental here.

Copy link
Contributor

@shalabhms shalabhms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm - nothing blocking . We need to close on the decision on TF dev Recipes which I think that is not blocking this PR changes and can be addressed/revisited based on the decision. Thanks !

@shalabhms
Copy link
Contributor

@kachawla , you might need to remove ADO issue reference and just reference the main GH issue and call out the changes as part of the feature since we do not have GH issues for tasks. Also we need to remove reference to internal SharePoint team docs. @AaronCrawfis , please confirm on this internal references for GH issue and guidance if any.

I have updated and linked to the main GH issue now and removed the ADO reference.

@kachawla
Copy link
Contributor Author

kachawla commented May 18, 2023

@kachawla , you might need to remove ADO issue reference and just reference the main GH issue and call out the changes as part of the feature since we do not have GH issues for tasks. Also we need to remove reference to internal SharePoint team docs. @AaronCrawfis , please confirm on this internal references for GH issue and guidance if any.

I have updated and linked to the main GH issue now and removed the ADO reference.

I'm curious why we shouldn't reference ADO issues? Whenever I see a PR linked to parent GH issue with multiple sub tasks, it becomes difficult to figure out which user story and which task to look at to get specific details.

@github-actions
Copy link

You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.

  • Swagger changes require reference edge docs to be updated here
  • Make sure to create a branch and submit a PR into the edge branch instead of the default latest branch, as the swagger changes will not be available until the next release.

For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/.

@github-actions

This comment has been minimized.

@kachawla
Copy link
Contributor Author

kachawla commented May 18, 2023

/lgtm - nothing blocking . We need to close on the decision on TF dev Recipes which I think that is not blocking this PR changes and can be addressed/revisited based on the decision. Thanks !

I'd expect that to covered as a part of #5528 / #5526, since the code updated here is getting removed in one of these PRs.

@kachawla
Copy link
Contributor Author

Are we adding CLI changes in a different PR?

Yeah added a quick note here earlier #5575 (comment), planning to do that after bicep and RP updates are merged, to keep the PRs scoped to smaller set of changes.

@github-actions
Copy link

63.9

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 63.9 %
  • main branch coverage: 63.9 %
  • diff coverage: 0 %

The coverage result does not include the functional test coverage.

@github-actions
Copy link

github-actions bot commented May 18, 2023

⌛ Building Radius and pushing container images for functional tests...

✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting samples functional tests...
❌ Test tool installation for corerp failed. Please check the logs for more details
❌ Failed to install Radius for corerp functional test. Please check the logs for more details
❌ corerp functional test failed. Please check the logs for more details
⌛ Starting corerp functional tests...
⌛ Starting samples functional tests...
⌛ Starting ucp functional tests...
❌ Test tool installation for ucp failed. Please check the logs for more details
❌ Failed to install Radius for ucp functional test. Please check the logs for more details
❌ ucp functional test failed. Please check the logs for more details
⌛ Starting ucp functional tests...
⌛ Starting samples functional tests...
⌛ Starting corerp functional tests...
❌ Test tool installation for samples failed. Please check the logs for more details
❌ Failed to install Radius for samples functional test. Please check the logs for more details
❌ samples functional test failed. Please check the logs for more details
⌛ Starting corerp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting samples functional tests...
❌ Test tool installation for corerp failed. Please check the logs for more details
❌ Failed to install Radius for corerp functional test. Please check the logs for more details
❌ Test tool installation for samples failed. Please check the logs for more details
❌ corerp functional test failed. Please check the logs for more details
❌ Failed to install Radius for samples functional test. Please check the logs for more details
❌ samples functional test failed. Please check the logs for more details
⌛ Starting corerp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting samples functional tests...
❌ Test tool installation for corerp failed. Please check the logs for more details
❌ Failed to install Radius for corerp functional test. Please check the logs for more details
❌ corerp functional test failed. Please check the logs for more details
❌ Test tool installation for samples failed. Please check the logs for more details
❌ Failed to install Radius for samples functional test. Please check the logs for more details
⌛ Starting ucp functional tests...
⌛ Starting corerp functional tests...
⌛ Starting samples functional tests...
❌ Test tool installation for ucp failed. Please check the logs for more details
❌ Failed to install Radius for ucp functional test. Please check the logs for more details
❌ ucp functional test failed. Please check the logs for more details
❌ Test tool installation for samples failed. Please check the logs for more details
❌ Failed to install Radius for samples functional test. Please check the logs for more details
❌ samples functional test failed. Please check the logs for more details
⌛ Starting corerp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting samples functional tests...
✅ ucp functional tests succeeded
✅ samples functional tests succeeded
❌ corerp functional test failed. Please check the logs for more details
⌛ Starting corerp functional tests...
✅ corerp functional tests succeeded

@kachawla kachawla merged commit 1a2c37d into main May 19, 2023
@kachawla kachawla deleted the kachawla/recipe-templatekind branch May 19, 2023 18:00
@kachawla kachawla mentioned this pull request May 19, 2023
5 tasks
@@ -124,3 +125,7 @@ func isValidLinkType(link string) bool {
}
return slices.Contains(linkTypes, link)
}

func isValidTemplateKind(link string) bool {
return slices.Contains(recipes.SupportedTemplateKind, link)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@rynowak rynowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

kachawla added a commit that referenced this pull request May 22, 2023
# Description

Added a new property for recipe templateKind in here
#5575. Switching the
property from optional to required and updating functional test
templates.

## Issue reference

Fixes Support multiple template types user story under
https://github.com/project-radius/radius/issues/4446.

## Checklist

Please make sure you've completed the relevant tasks for this PR, out of
the following list:

* [x] Code compiles correctly
* [x] Adds necessary unit tests for change
* [x] Adds necessary E2E tests for change
* [x] Unit tests passing
* [x] Extended the documentation / Created issue for it -- Created issue

---------

Co-authored-by: karishma-chawla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants