-
Notifications
You must be signed in to change notification settings - Fork 100
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 recipe support to dynamic RP #8191
Conversation
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 <[email protected]>
/cc @lakshmimsft - this is still like 2% in progress. I have a few test regressions to chase down. I think I made a few small mistakes in the refactor that broke non-UDT tests. |
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... |
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.
Can't wait for all this to be release
@@ -50,7 +50,7 @@ func (c *Application) OutputResources() []rpv1.OutputResource { | |||
} | |||
|
|||
// ResourceMetadata returns the BasicResourceProperties of the Application instance. | |||
func (h *Application) ResourceMetadata() *rpv1.BasicResourceProperties { |
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.
All the function comments need to be updated to reflect the new return type
return &DynamicResourceController{ | ||
BaseController: ctrl.NewBaseAsyncController(opts), | ||
BaseController: ctrl.NewBaseAsyncController(opts), |
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.
thanks for this, misaligned drives me a little nuts, my problem not yours ;)
unqualifiedTypeName := strings.TrimPrefix(id.Type(), id.ProviderNamespace()+resources.SegmentSeparator) | ||
response, err := c.ucp.NewResourceTypesClient().Get( | ||
ctx, | ||
id.ScopeSegments()[0].Name, |
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.
Are there any scenarios where this could throw a panic due to the array coming back empty?
type dynamicProcessor struct { | ||
} | ||
|
||
func (d *dynamicProcessor) Delete(ctx context.Context, resource *datamodel.DynamicResource, options processors.Options) error { |
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.
Could we get a comment as to why this is effectively noop?
Picking this PR up. I will address comments/updates in PR: #8267 |
Description
This change implements recipe support for 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
Part of: #6688
Contributor checklist
Please verify that the PR meets the following requirements, where applicable: