Skip to content

Add routes recipes - #50

Merged
sk593 merged 15 commits into
radius-project:mainfrom
sk593:add-routes-recipes
Jan 29, 2026
Merged

sk593 merged 15 commits into
radius-project:mainfrom
sk593:add-routes-recipes

Conversation

@sk593

@sk593 sk593 commented Sep 15, 2025 •

Copy link
Copy Markdown
Collaborator

This PR adds Recipes for the Routes resource type. Since Routes need a container for the connection to work, this PR also adds a simple container Recipe

@sk593
sk593 force-pushed the add-routes-recipes branch 7 times, most recently from 92aa70e to de46894 Compare September 15, 2025 22:30
Comment thread .github/scripts/validate-common.sh Outdated
# Define common configuration
setup_config() {
resource_folders=("Security")
# Define specific resource types to test instead of entire folders

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updating the workflow to allow testing to be added for individual resources instead of a namespace

Comment thread Compute/routes/recipes/kubernetes/bicep/kubernetes-routes.bicep Outdated
@sk593
sk593 force-pushed the add-routes-recipes branch 3 times, most recently from 26f04ab to 801d78a Compare September 15, 2025 23:58
Comment thread Compute/routes/recipes/kubernetes/terraform/main.tf Outdated
Comment thread Compute/routes/test/app.bicep Outdated
}
}

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {

@sk593 sk593 Sep 16, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added this application template as an example of how the routes resource can be deployed. I'm not sure that we'd want this to be a test scenario for the repo since it's more of an integration/E2E test and it'd require the Gateway CRD to be installed on the test cluster (I set up the CRDs and necessary RBAC to deploy this when manually testing to verify that it'd work)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm open to suggestions on if this should be included in this repo's test framework

Comment thread Compute/routes/recipes/kubernetes/terraform/main.tf Outdated
namespace: context.runtime.kubernetes.namespace
}
]
hostnames: length(hostnames) > 0 ? hostnames : ['localhost']

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than defaulting to localhost, I think this should be not specified if it is not provided. From the docs:

If no hostname is specified, traffic is routed based on HTTPRoute rules and filters (optional).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I noticed this was not updated in the Terraform Recipe, only Bicep.

backendRefs: [
{
name: '${toLower(last(split(rule.destinationContainer.resourceId, '/')))}-${rule.destinationContainer.containerName}'
port: 80

@zachcasper zachcasper Sep 30, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs reference rule.destinationContainer.containerPortName. We cannot assume a port number.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Discussed offline. We'll update the containerPortName variable to expect an integer so it can be passed as an accessible input variable

@sk593
sk593 marked this pull request as ready for review September 30, 2025 18:42
@sk593
sk593 requested review from a team as code owners September 30, 2025 18:42
@sk593
sk593 force-pushed the add-routes-recipes branch from c60f4df to 20f2eb0 Compare September 30, 2025 19:21
@lakshmimsft

Copy link
Copy Markdown
Contributor

application is set to required in the schema.

required: [environment, application, rules]

But it's not required in the recipe. Pls check if we need to update schema to align with recipe.

@lakshmimsft

Copy link
Copy Markdown
Contributor

@zachcasper , @sk593 perhaps this was discussed already but should include gRPC as another route_kind in the yaml and update the recipe for it?

@sk593
sk593 force-pushed the add-routes-recipes branch from 20f2eb0 to 00cacb0 Compare October 21, 2025 16:55
@sk593

sk593 commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator Author

@zachcasper , @sk593 perhaps this was discussed already but should include gRPC as another route_kind in the yaml and update the recipe for it?

I don't think this was discussed but we can add gRPC. thoughts @zachcasper ?

@YohanSciubukgian

Copy link
Copy Markdown

Will this support WebSocket connections, including HTTPS-to-WSS protocol switching, especially in the context of route-based promotion capabilities?

@sk593
sk593 force-pushed the add-routes-recipes branch from 00cacb0 to ec78cda Compare October 28, 2025 21:18
@sk593

sk593 commented Oct 28, 2025

Copy link
Copy Markdown
Collaborator Author

Will this support WebSocket connections, including HTTPS-to-WSS protocol switching, especially in the context of route-based promotion capabilities?

I'm not too familiar with HTTPs-to-WSS but I believe it should. Routes support HTTP/HTTPS so the setup for a WebSocket connection would need to be defined in the Recipe. @zachcasper do you have any additional input on this?

@sk593

sk593 commented Oct 28, 2025

Copy link
Copy Markdown
Collaborator Author

application is set to required in the schema.

required: [environment, application, rules]

But it's not required in the recipe. Pls check if we need to update schema to align with recipe.

I don't think it needs to be required by the Recipe. But the resource should be tied to an application


// Assume Gateway already exists - use a default gateway name
// Platform engineers should configure this via recipe parameters or environment
var gatewayName = 'default-gateway'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What gateway controllers use default-gateway such that we should assume a default? I looked at NGINX and the default name is the release name. The Cilium gateway name is cilium.

I'm afraid users will get an error that says "default-gateway gateway not found" instead of "gatewayName parameter not set".

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The recipe was being tested using the Kubernetes Gateway API. We can update this to use a parameter instead of a default name

@zachcasper

Copy link
Copy Markdown
Contributor

application is set to required in the schema.

required: [environment, application, rules]

But it's not required in the recipe. Pls check if we need to update schema to align with recipe.

What would it mean to require application in the Recipe since application is only within Radius? I don't quite understand what you're proposing.

@zachcasper

Copy link
Copy Markdown
Contributor

Will this support WebSocket connections, including HTTPS-to-WSS protocol switching, especially in the context of route-based promotion capabilities?

I'm not too familiar with HTTPs-to-WSS but I believe it should. Routes support HTTP/HTTPS so the setup for a WebSocket connection would need to be defined in the Recipe. @zachcasper do you have any additional input on this?

That sounds right to me. Should be HTTP route type.

@zachcasper

Copy link
Copy Markdown
Contributor

@zachcasper , @sk593 perhaps this was discussed already but should include gRPC as another route_kind in the yaml and update the recipe for it?

I don't think this was discussed but we can add gRPC. thoughts @zachcasper ?

gRPC can easily be added in the future. We've covered the majority of cases here.

Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
@sk593
sk593 force-pushed the add-routes-recipes branch from 2f5ef09 to fb57293 Compare November 19, 2025 17:32
Signed-off-by: sk593 <shruthikumar@microsoft.com>
@sk593
sk593 force-pushed the add-routes-recipes branch from 648770a to 01d5129 Compare November 24, 2025 22:32
Signed-off-by: sk593 <shruthikumar@microsoft.com>
@sk593
sk593 force-pushed the add-routes-recipes branch from 01d5129 to 59ab01d Compare November 24, 2025 22:35

@zachcasper zachcasper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You're still missing recipe parameters for the gateway resource name and gateway resource namespace.

Also the containerPort vs containerPortName is not complete.

Comment thread Compute/routes/routes.yaml Outdated
resourceId: myContainer.id
containerName: 'frontend'
containerPortName: 'web'
containerPort: 'web'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't remember what we discussed offline. Can you explain again why containerPortName was changed to containerPort? I suppose it's fine, albeit inconsistent, to specify the value rather than the name.

However, your examples are not compliant with the current schema since you have a string value in a integer property.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated the examples to match the type.

Kubernetes expects a integer for the port number, not the name of the port. So this was updated to containerPort so we pass through the integer value, not the name

Comment on lines +21 to +25
route_base_labels = {
"radapp.io/resource" = local.resource_name
"radapp.io/environment" = local.environment_label
"radapp.io/application" = var.context.application == null ? "" : var.context.application.name
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
route_base_labels = {
"radapp.io/resource" = local.resource_name
"radapp.io/environment" = local.environment_label
"radapp.io/application" = var.context.application == null ? "" : var.context.application.name
}
route_base_labels = {
"radapp.io/resource" = local.resource_name
"radapp.io/environment" = local.environment_label
"radapp.io/application" = var.context.application == null ? "" : var.context.application.name
"radapp.io/resource-type" = replace(var.context.resource.type, "/", "-")
"radapp.io/resource-group" = split("/", var.context.resource.id)[4]
}

We agreed here that we would have these standard labels:

  • radapp.io/resource
  • radapp.io/resource-type
  • radapp.io/application
  • radapp.io/environment
  • radapp.io/resource-group
  • radapp.io/recipe-pack

parentRefs = [
{
name = local.gateway_name
namespace = var.context.runtime.kubernetes.namespace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a false assumption that the gateway resource is in the same namespace as the application. In fact, I would imagine it would never be in the same namespace. Just like the gateway, we need recipe parameters for the gateway name and gateway namespace.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Synced offline. There were default values for the parameters but we'll remove these and add docs on the gateway name and namespace being required inputs.


# Assume Gateway already exists - use a default gateway name
# Platform engineers should configure this via recipe parameters or environment
gateway_name = "default-gateway"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Repeating my previous comment:

What gateway controllers use default-gateway such that we should assume a default? I looked at NGINX and the default name is the release name. The Cilium gateway name is cilium. I'm afraid users will get an error that says "default-gateway gateway not found" instead of "gatewayName parameter not set".

I would go further and say we should NOT assume a gateway name. Platform engineers need to install a gateway controller and set the gateway name and namespace as recipe parameters.

That prerequisite needs to be clearly documented in the README.md.

Comment thread Compute/routes/recipes/kubernetes/terraform/main.tf Outdated
Comment thread Compute/routes/recipes/kubernetes/terraform/main.tf Outdated
? "${split("/", rule.destinationContainer.resourceId)[length(split("/", rule.destinationContainer.resourceId)) - 1]}-${rule.destinationContainer.containerName}"
: split("/", rule.destinationContainer.resourceId)[length(split("/", rule.destinationContainer.resourceId)) - 1]
)
port = try(rule.destinationContainer.containerPort, 80)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not a port number here. It's fine on HTTP and TLS, but it doesn't make sense when using a TCPRoute.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think the port number is required for backendrefs since they're referring to a Kubernetes service? https://gateway-api.sigs.k8s.io/reference/spec/?utm_source=chatgpt.com#portnumber

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Synced offline, we'll remove defaults here

Comment thread Compute/routes/recipes/kubernetes/terraform/main.tf Outdated
Comment thread Compute/routes/recipes/kubernetes/terraform/main.tf Outdated
@sk593
sk593 force-pushed the add-routes-recipes branch from 8b40108 to 057536d Compare January 22, 2026 21:44
sk593 added 2 commits January 22, 2026 13:44
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
@sk593
sk593 force-pushed the add-routes-recipes branch from d63c75f to c8a39f7 Compare January 27, 2026 23:50
zachcasper
zachcasper previously approved these changes Jan 28, 2026
Signed-off-by: sk593 <shruthikumar@microsoft.com>
@sk593
sk593 merged commit 97d45df into radius-project:main Jan 29, 2026
3 checks passed
shivg7795 pushed a commit to shivg7795/resource-types-contrib-shivg that referenced this pull request Jul 9, 2026
This PR adds Recipes for the Routes resource type. Since Routes need a
container for the connection to work, this PR also adds a simple
container Recipe

---------

Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: shivg7795 <shivg@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.

5 participants