Skip to content

Conversation

lakshmimsft
Copy link
Contributor

@lakshmimsft lakshmimsft commented Jan 21, 2025

This is continuation of the previous PR (#8191)
All comments from previous PR will be addressed here.

Description

Original Description:
This change implements recipe support fo the dynamic RP. With this feature, a user-defined-type can declare the SupportsRecipes capability, and then it will be processed by the recipe engine.

The main change here is to the core datamodel interfaces used by our shared controllers. These interfaces have some problematic definitions that rely on returning pointers to go-structs so they can be mutated and saved to the database. This general approach does not work for UDT, or any other design besides the portable resources.

To understand this problem in more detail, consider that ".properties.status" is user-defined for a UDT. The existing interfaces assume that all resources have the same go struct at ".properties.status". Because UDT is extensible, we cannot write a single go-struct that captures all possible status values, but that's required by the current interfaces. Clearly we need something more flexible.

I took the approach of making minimal changes in this PR, but we should improve the design longer-term.

Type of change

Fixes: Part of #6688

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
  • If applicable, design document has been reviewed and approved by Radius maintainers/approvers.
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.

@radius-functional-tests
Copy link

radius-functional-tests bot commented Jan 22, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref c1a1fa7
Unique ID func8991188e75
Image tag pr-func8991188e75
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func8991188e75
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func8991188e75
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func8991188e75
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func8991188e75
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func8991188e75
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
❌ Failed to install Radius for ucp-cloud functional test. Please check the logs for more details
❌ ucp-cloud functional test failed. Please check the logs for more details
❌ corerp-cloud functional test cancelled. Please check the logs for more details
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
❌ ucp-cloud functional test failed. Please check the logs for more details
❌ corerp-cloud functional test cancelled. Please check the logs for more details

@radius-functional-tests
Copy link

radius-functional-tests bot commented Jan 22, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref 84c52fd
Unique ID func9126d64ddf
Image tag pr-func9126d64ddf
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func9126d64ddf
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func9126d64ddf
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func9126d64ddf
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func9126d64ddf
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func9126d64ddf
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
❌ corerp-cloud functional test failed. Please check the logs for more details
⌛ Starting corerp-cloud functional tests...
❌ corerp-cloud functional test failed. Please check the logs for more details

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 44.02036% with 220 lines in your changes missing coverage. Please review.

Project coverage is 55.65%. Comparing base (16c5c79) to head (ecedcb3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/dynamicrp/datamodel/dynamicresource.go 51.07% 64 Missing and 4 partials ⚠️
pkg/dynamicrp/backend/processor/dynamicresource.go 0.00% 28 Missing ⚠️
...kg/dynamicrp/backend/controller/dynamicresource.go 73.13% 15 Missing and 3 partials ⚠️
pkg/rp/v1/types.go 38.09% 13 Missing ⚠️
...urces/backend/controller/createorupdateresource.go 54.54% 9 Missing and 1 partial ⚠️
pkg/daprrp/setup/setup.go 0.00% 8 Missing ⚠️
pkg/dynamicrp/backend/service.go 0.00% 7 Missing ⚠️
pkg/datastoresrp/setup/setup.go 0.00% 6 Missing ⚠️
pkg/dynamicrp/backend/controller/deleterecipe.go 53.84% 6 Missing ⚠️
pkg/dynamicrp/backend/controller/putrecipe.go 53.84% 6 Missing ⚠️
... and 18 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8267      +/-   ##
==========================================
- Coverage   55.72%   55.65%   -0.08%     
==========================================
  Files         595      599       +4     
  Lines       40481    40750     +269     
==========================================
+ Hits        22557    22678     +121     
- Misses      16211    16354     +143     
- Partials     1713     1718       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@radius-functional-tests
Copy link

radius-functional-tests bot commented Feb 7, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref f6e4c54
Unique ID func2419acc6cc
Image tag pr-func2419acc6cc
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func2419acc6cc
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func2419acc6cc
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func2419acc6cc
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func2419acc6cc
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func2419acc6cc
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@radius-functional-tests
Copy link

radius-functional-tests bot commented Feb 9, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref ded457d
Unique ID funcaf32140480
Image tag pr-funcaf32140480
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funcaf32140480
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funcaf32140480
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcaf32140480
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcaf32140480
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcaf32140480
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@radius-functional-tests
Copy link

radius-functional-tests bot commented Mar 17, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref 4f9db83
Unique ID func280557b652
Image tag pr-func280557b652
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func280557b652
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func280557b652
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func280557b652
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func280557b652
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func280557b652
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
❌ corerp-cloud functional test failed. Please check the logs for more details
⌛ Starting corerp-cloud functional tests...
❌ corerp-cloud functional test failed. Please check the logs for more details

@radius-functional-tests
Copy link

radius-functional-tests bot commented Mar 17, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref df4b407
Unique ID funcbd023478dc
Image tag pr-funcbd023478dc
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funcbd023478dc
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funcbd023478dc
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcbd023478dc
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcbd023478dc
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcbd023478dc
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ corerp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded

Copy link
Contributor

@kachawla kachawla left a comment

Choose a reason for hiding this comment

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

Still reviewing, comments so far

Comment on lines +69 to +71
if status == nil {
status = new(rpv1.RecipeStatus)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'm still confused why are we checking if it is nil or not first, something that's not being done for other inputs here. Are we trying to preserve status from a previous run but not rest of the values? And I understand that this was already done in the create/update controller as you pointed out, so this update it just moving it from controller to validator. But I don't understand why status is being handled differently. Let me know if you have more insights on that, else could you please log an issue for us to come back to it to understand it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tracking issue: #8922

Comment on lines +129 to +131
if recipeOutput != nil && recipeOutput.Status != nil {
setRecipeStatus(data, *recipeOutput.Status)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this have been during Process call above?

if recipeOutput != nil && recipeOutput.Status != nil {
			setRecipeStatus(data, *recipeOutput.Status)
		}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pending

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code to remove this and update recipe status in the dynamicrp Processor. The dynamicrp tests and functionality runs as expeced but it took a long time to debug issue with other portable types. They do not update the op resources and recipestatus in their processors in the expected location. Keeping current changes for now till dynamicrp processor is mainly in use.

Comment on lines 184 to 192
// setRecipeStatus sets the recipe status for the given resource model.
// It retrieves the resource metadata from the provided model, deep copies the current resource status,
// updates the Recipe field with the supplied recipeStatus, and then applies the updated status back to the resource.
func setRecipeStatus[P rpv1.RadiusResourceModel](data P, recipeStatus rpv1.RecipeStatus) {
rm := data.ResourceMetadata()
status := rm.GetResourceStatus().DeepCopy()
status.Recipe = &recipeStatus
rm.SetResourceStatus(status)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on our other discussion, this DeepCopy is only deep copuing the recipe status which you are replacing here, so I'm confused about this implementation. Can you help me understand why is the DeepCopy() necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pending (creating tracking issue/investigate)

Copy link
Contributor Author

@lakshmimsft lakshmimsft Apr 18, 2025

Choose a reason for hiding this comment

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

Updated code to remove this block and update recipe status in the dynamicrp Processor. The dynamicrp tests and functionality runs as expeced but it took a long time to debug issue with other portable types. They do not update the op resources and recipestatus in their processors in the expected location. Keeping current changes for now till dynamicrp processor is mainly in use.

if recipeDataModel.Recipe() != nil {
recipeDataModel.Recipe().DeploymentStatus = util.Success

recipeDataModel, supportsRecipes := any(data).(datamodel.RecipeDataModel)
Copy link
Contributor

Choose a reason for hiding this comment

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

This type assertion any(data).(datamodel.RecipeDataModel) is repeated multiple times including in executeRecipesIfNeeded. We can move this above L89 (recipeOutput, err := c.executeRecipeIfNeeded(ctx, data, previousOutputResources, config.Simulated)) and use the output everywhere else. supportsRecipes would be passed as an input to executeRecipeIfNeeded, or we can just skip that call if supportsRecipes evaluates to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pending

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated this to reduce repitition. kept executeRecipeIfNeeded() untouched for now since it needs data, recipeDataModel and supportRecipes

rynowak and others added 5 commits March 19, 2025 20:10
This change implements recipe support fo the dynamic RP. With this feature, a user-defined-type can declare the SupportsRecipes capability, and then it will be processed by the recipe engine.

The main change here is to the core datamodel interfaces used by our shared controllers. These interfaces have some problematic definitions that rely on returning pointers to go-structs so they can be mutated and saved to the database. This general approach does not work for UDT, or any other design besides the portable resources.

To understand this problem in more detail, consider that ".properties.status" is user-defined for a UDT. The existing interfaces assume that all resources have the same go struct at ".properties.status". Because UDT is extensible, we cannot write a single go-struct that captures all possible status values, but that's required by the current interfaces. Clearly we need something more flexible.

I took the approach of making minimal changes in this PR, but we should improve the design longer-term.

Signed-off-by: Ryan Nowak <nowakra@gmail.com>
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Mar 20, 2025

Radius functional test overview

🔍 Go to test action run

Name Value
Repository lakshmimsft/radius-mainfork
Commit ref ecedcb3
Unique ID func310105f7c6
Image tag pr-func310105f7c6
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr:
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func310105f7c6
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func310105f7c6
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func310105f7c6
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func310105f7c6
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func310105f7c6
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@lakshmimsft lakshmimsft merged commit 571a607 into radius-project:main Mar 20, 2025
29 checks passed
lakshmimsft added a commit that referenced this pull request May 20, 2025
# Description

This is a PR to address some pending investigations issues in
#8267:

#8267 (comment)

#8267 (comment)

and Test updates in #8924. 

#8924 (comment)

#8924 (comment)

#8924 (comment)

Still a draft PR to make sure all tests work as expected.

## Type of change

- This pull request is a minor refactor, code cleanup, test improvement,
or other maintenance task and doesn't change the functionality of Radius
(issue link optional).

Fixes: 

## Contributor checklist
Please verify that the PR meets the following requirements, where
applicable:

- An overview of proposed schema changes is included in a linked GitHub
issue.
    - [ ] Yes
    - [ ] Not applicable
- A design document PR is created in the [design-notes
repository](https://github.com/radius-project/design-notes/), if new
APIs are being introduced.
    - [ ] Yes
    - [ ] Not applicable
- The design document has been reviewed and approved by Radius
maintainers/approvers.
    - [ ] Yes
    - [ ] Not applicable
- A PR for the [samples
repository](https://github.com/radius-project/samples) is created, if
existing samples are affected by the changes in this PR.
    - [ ] Yes
    - [ ] Not applicable
- A PR for the [documentation
repository](https://github.com/radius-project/docs) is created, if the
changes in this PR affect the documentation or any user facing updates
are made.
    - [ ] Yes
    - [ ] Not applicable
- A PR for the [recipes
repository](https://github.com/radius-project/recipes) is created, if
existing recipes are affected by the changes in this PR.
    - [ ] Yes
    - [ ] Not applicable

---------

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
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.

3 participants