-
Notifications
You must be signed in to change notification settings - Fork 96
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
Conversation
You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.
For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/. |
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
@@ -479,6 +480,10 @@ | |||
"EnvironmentRecipeProperties": { | |||
"description": "Properties of a Recipe linked to an Environment.", | |||
"properties": { | |||
"templateKind": { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
pkg/corerp/frontend/controller/environments/createorupdateenvironment.go
Show resolved
Hide resolved
Test Results2 703 tests +1 2 696 ✔️ +1 1m 55s ⏱️ ±0s 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.
♻️ This comment has been updated with latest results. |
...tions/resource-manager/Applications.Core/preview/2022-03-15-privatepreview/environments.json
Show resolved
Hide resolved
You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.
For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/. |
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
0ce3b99
to
2ef9ec2
Compare
You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.
For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/. |
Radius functional test overview
Click here to see the list of tools in the current test run
Test Status⌛ Building Radius and pushing container images for functional tests... |
"templateKind": { | ||
"description": "Format of the template provided by the recipe. Allowed values: bicep", | ||
"type": "string" | ||
}, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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
?)
pkg/corerp/api/v20220315privatepreview/environmentrecipeproperties_conversion_test.go
Show resolved
Hide resolved
pkg/corerp/frontend/controller/environments/createorupdateenvironment.go
Show resolved
Hide resolved
@@ -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, |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
Are we adding CLI changes in a different PR? |
@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, |
There was a problem hiding this comment.
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
Driver: *found.TemplateKind, | |
DriverKind: *found.TemplateKind, |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this 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 !
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. |
You are editing files which require a docs update. Please ensure you've made the appropriate changes to the docs and submitted a PR.
For more information on contributing to docs please visit https://docs.radapp.dev/contributing/docs/. |
This comment has been minimized.
This comment has been minimized.
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. |
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. |
⌛ Building Radius and pushing container images for functional tests... ✅ Container images build succeeded |
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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]>
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: