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 recipe support to extenders #5706

Merged
merged 16 commits into from
Jun 19, 2023
Prev Previous commit
Next Next commit
updating tests
  • Loading branch information
sk593 committed Jun 19, 2023
commit 3ee070eb4ec196f1979e2f35e8a519a93c8986f0

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@
* **application**: string: Fully qualified resource ID for the application that the link is consumed by
* **environment**: string (Required): Fully qualified resource ID for the environment that the link is linked to
* **provisioningState**: 'Accepted' | 'Canceled' | 'Deleting' | 'Failed' | 'Provisioning' | 'Succeeded' | 'Updating' (ReadOnly): Provisioning state of the link at the time the operation was called
* **recipe**: [Recipe](#recipe) (WriteOnly): The recipe used to automatically deploy underlying infrastructure for a link
* **resourceProvisioning**: 'manual' | 'recipe' (WriteOnly): Specifies how the underlying service/resource is provisioned and managed. Available values are 'recipe', where Radius manages the lifecycle of the resource through a Recipe, and 'manual', where a user manages the resource and provides the values.
sk593 marked this conversation as resolved.
Show resolved Hide resolved
* **secrets**: [ExtenderSecrets](#extendersecrets) (WriteOnly): The secret values for the given Extender resource
* **status**: [ResourceStatus](#resourcestatus) (ReadOnly): Status of a resource.
### Additional Properties
Expand Down
2 changes: 1 addition & 1 deletion hack/bicep-types-radius/generated/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Resources":{"Applications.Core/environments@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":51},"Applications.Core/applications@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":75},"Applications.Core/httpRoutes@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":89},"Applications.Core/gateways@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":110},"Applications.Core/containers@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":175},"Applications.Core/volumes@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":212},"Applications.Core/secretStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":235},"Applications.Core/extenders@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":250},"Applications.Dapr/daprPubSubBrokers@2022-03-15-privatepreview":{"RelativePath":"applications/applications.dapr/2022-03-15-privatepreview/types.json","Index":41},"Applications.Dapr/daprSecretStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.dapr/2022-03-15-privatepreview/types.json","Index":59},"Applications.Dapr/daprStateStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.dapr/2022-03-15-privatepreview/types.json","Index":79},"Applications.Datastores/mongoDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":42},"Applications.Datastores/redisCaches@2022-03-15-privatepreview":{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":63},"Applications.Datastores/sqlDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":83},"Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":40},"Applications.Link/daprSecretStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":57},"Applications.Link/daprStateStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":75},"Applications.Link/mongoDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":94},"Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":112},"Applications.Link/redisCaches@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":131},"Applications.Link/sqlDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":150},"Applications.Link/extenders@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":165},"Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview":{"RelativePath":"applications/applications.messaging/2022-03-15-privatepreview/types.json","Index":40}},"Functions":{"applications.core/secretstores":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":256}]},"applications.core/extenders":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":258}]},"applications.datastores/mongodatabases":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":85}]},"applications.datastores/rediscaches":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":87}]},"applications.link/mongodatabases":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":167}]},"applications.link/rabbitmqmessagequeues":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":169}]},"applications.link/rediscaches":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":171}]},"applications.link/sqldatabases":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":173}]},"applications.link/extenders":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":175}]},"applications.messaging/rabbitmqqueues":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.messaging/2022-03-15-privatepreview/types.json","Index":42}]}}}
{"Resources":{"Applications.Core/environments@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":51},"Applications.Core/applications@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":75},"Applications.Core/httpRoutes@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":89},"Applications.Core/gateways@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":110},"Applications.Core/containers@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":175},"Applications.Core/volumes@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":212},"Applications.Core/secretStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":235},"Applications.Core/extenders@2022-03-15-privatepreview":{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":250},"Applications.Dapr/daprPubSubBrokers@2022-03-15-privatepreview":{"RelativePath":"applications/applications.dapr/2022-03-15-privatepreview/types.json","Index":41},"Applications.Dapr/daprSecretStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.dapr/2022-03-15-privatepreview/types.json","Index":59},"Applications.Dapr/daprStateStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.dapr/2022-03-15-privatepreview/types.json","Index":79},"Applications.Datastores/mongoDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":42},"Applications.Datastores/redisCaches@2022-03-15-privatepreview":{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":63},"Applications.Datastores/sqlDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":83},"Applications.Link/daprInvokeHttpRoutes@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":35},"Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":54},"Applications.Link/daprSecretStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":71},"Applications.Link/daprStateStores@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":89},"Applications.Link/mongoDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":108},"Applications.Link/rabbitMQMessageQueues@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":126},"Applications.Link/redisCaches@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":145},"Applications.Link/sqlDatabases@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":163},"Applications.Link/extenders@2022-03-15-privatepreview":{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":181},"Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview":{"RelativePath":"applications/applications.messaging/2022-03-15-privatepreview/types.json","Index":40}},"Functions":{"applications.core/secretstores":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":256}]},"applications.core/extenders":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.core/2022-03-15-privatepreview/types.json","Index":258}]},"applications.datastores/mongodatabases":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":85}]},"applications.datastores/rediscaches":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.datastores/2022-03-15-privatepreview/types.json","Index":87}]},"applications.link/mongodatabases":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":183}]},"applications.link/rabbitmqmessagequeues":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":185}]},"applications.link/rediscaches":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":187}]},"applications.link/extenders":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.link/2022-03-15-privatepreview/types.json","Index":189}]},"applications.messaging/rabbitmqqueues":{"2022-03-15-privatepreview":[{"RelativePath":"applications/applications.messaging/2022-03-15-privatepreview/types.json","Index":42}]}}}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"secrets": {
"accountSid": "sid",
"authToken:": "token"
}
},
"resourceProvisioning": "manual"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"properties": {
"application": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/applications/testApplication",
"environment": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0",
"fromNumber": "222-222-2222"
"fromNumber": "222-222-2222",
"resourceProvisioning": "manual"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Link/extenders/extender0",
"name": "extender0",
"type": "Applications.Link/extenders",
"properties": {
"status": {
"outputResources": [{
"LocalID": "Deployment",
"ResourceType": {
"Type": "Extender",
"Provider": "ExtenderProvider"
}
}]
},
"application": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/applications/testApplication",
"environment": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0",
"recipe": {
"name": "test-recipe"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"secrets": {
"accountSid": "sid",
"authToken:": "token"
}
},
"resourceProvisioning": "manual"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"environment": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0",
"additionalProperties":{
"fromNumber": "222-222-2222"
}
},
"resourceProvisioning": "manual"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Link/extenders/extender0",
"name": "extender0",
"type": "Applications.Link/extenders",
"systemData": {
"createdBy": "fakeid@live.com",
"createdByType": "User",
"createdAt": "2021-09-24T19:09:54.2403864Z",
"lastModifiedBy": "fakeid@live.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-09-24T20:09:54.2403864Z"
},
"tags": {
"env": "dev"
},
"properties": {
"status": {
"outputResources": [{
"LocalID": "Deployment",
"ResourceType": {
"Type": "Extender",
"Provider": "ExtenderProvider"
}
}]
},
"application": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/applications/testApplication",
"environment": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0",
"recipe": {
"name": "test-recipe"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"environment": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/radius-test-rg/providers/Applications.Core/environments/env0",
"additionalProperties":{
"fromNumber": "222-222-2222"
}
},
"resourceProvisioning": "manual"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@
"secrets": {
"additionalProperties": true,
"$ref": "#/definitions/ExtenderSecrets"
},
"resourceProvisioning": {
"$ref": "openapi.json#/definitions/ResourceProvisioning",
"description": "Specifies how the underlying service/resource is provisioned and managed."
},
"recipe": {
"$ref": "openapi.json#/definitions/Recipe",
"description": "The recipe used to automatically deploy underlying infrastructure for the daprPubSubBroker link"
}
}
}
Expand Down
38 changes: 38 additions & 0 deletions test/functional/corerp/resources/extender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,41 @@ func Test_Extender(t *testing.T) {

test.Test(t)
}

func Test_ExtenderRecipe(t *testing.T) {
template := "testdata/corerp-resources-extender-recipe.bicep"
name := "corerp-resources-extender-recipe"
appNamespace := "default-corerp-resources-extender-recipe"

test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{
{
Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()),
CoreRPResources: &validation.CoreRPResourceSet{
Resources: []validation.CoreRPResource{
{
Name: name,
Type: validation.ApplicationsResource,
},
{
Name: "extr-ctnr",
Type: validation.ContainersResource,
App: name,
},
{
Name: "extr-twilio",
Type: validation.ExtendersResource,
},
},
},
K8sObjects: &validation.K8sObjectSet{
Namespaces: map[string][]validation.K8sObject{
appNamespace: {
validation.NewK8sPodForResource(name, "extr-ctnr"),
},
},
},
},
})

test.Test(t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import radius as rad

param application string
param environment string

resource s3Extender 'Applications.Link/extenders' = {
name: 's3'
properties: {
environment: environment
application: application
recipe: {
name: 's3'
}
}
}

resource container 'Applications.Core/containers' = {
name: 'mycontainer'
properties: {
application: application
container: {
image: '*****'
// In this case, I need to set the bucketname to an env name I already use
env: {
// Access property
// User needs to know name of the property (tooling does not)
BUCKETNAME: s3.properties.bucketName
// Access secrets (permissioned separately than properties and not part of the resource body)
DBSECRET: s3.secrets('databaseSecret')
}
}
connections: {
// This sets environment variable(s) on the container
// CONNECTION_S3_BUCKETNAME
// CONNECTION_S3_DATABASESECRET
s3: {
source: s3.id
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ resource container 'Applications.Core/containers@2022-03-15-privatepreview' = {
}
}
connections: {}
resourceProvisioning: 'manual'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Working on adding a recipe test with an AWS S3 bucket

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Synced with @willdavsmith and we verified that extenders deploy successfully with an AWS S3 bucket manually. Bunsen is working on AWS functional tests so this will be tested with that work. Updated the recipe func test to use Kubernetes deployments instead

}
}