Repository navigation
Add routes recipes - #50
Conversation
92aa70e to
de46894
Compare
| # Define common configuration | ||
| setup_config() { | ||
| resource_folders=("Security") | ||
| # Define specific resource types to test instead of entire folders |
There was a problem hiding this comment.
Updating the workflow to allow testing to be added for individual resources instead of a namespace
26f04ab to
801d78a
Compare
| } | ||
| } | ||
|
|
||
| resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
I'm open to suggestions on if this should be included in this repo's test framework
| namespace: context.runtime.kubernetes.namespace | ||
| } | ||
| ] | ||
| hostnames: length(hostnames) > 0 ? hostnames : ['localhost'] |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
This needs reference rule.destinationContainer.containerPortName. We cannot assume a port number.
There was a problem hiding this comment.
Discussed offline. We'll update the containerPortName variable to expect an integer so it can be passed as an accessible input variable
c60f4df to
20f2eb0
Compare
|
But it's not required in the recipe. Pls check if we need to update schema to align with recipe. |
|
@zachcasper , @sk593 perhaps this was discussed already but should include gRPC as another route_kind in the yaml and update the recipe for it? |
20f2eb0 to
00cacb0
Compare
I don't think this was discussed but we can add gRPC. thoughts @zachcasper ? |
|
Will this support WebSocket connections, including HTTPS-to-WSS protocol switching, especially in the context of route-based promotion capabilities? |
00cacb0 to
ec78cda
Compare
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? |
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' |
There was a problem hiding this 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".
There was a problem hiding this comment.
The recipe was being tested using the Kubernetes Gateway API. We can update this to use a parameter instead of a default name
What would it mean to require |
That sounds right to me. Should be HTTP route type. |
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>
2f5ef09 to
fb57293
Compare
Signed-off-by: sk593 <shruthikumar@microsoft.com>
648770a to
01d5129
Compare
01d5129 to
59ab01d
Compare
zachcasper
left a comment
There was a problem hiding this comment.
You're still missing recipe parameters for the gateway resource name and gateway resource namespace.
Also the containerPort vs containerPortName is not complete.
| resourceId: myContainer.id | ||
| containerName: 'frontend' | ||
| containerPortName: 'web' | ||
| containerPort: 'web' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
| 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 | ||
| } |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
| ? "${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) |
There was a problem hiding this comment.
We should not a port number here. It's fine on HTTP and TLS, but it doesn't make sense when using a TCPRoute.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Synced offline, we'll remove defaults here
8b40108 to
057536d
Compare
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
d63c75f to
c8a39f7
Compare
Signed-off-by: sk593 <shruthikumar@microsoft.com>
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>
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