Fix httpRoute port property to render as integer instead of string #488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix httpRoute port property to be integer instead of string
Fixes an issue where the httpRoute port property was being rendered as a string (
"8080") instead of an integer (8080), causing Gateway API validation errors when deploying with Terraform's helm_release.Changes Made
application.httpRoute.rules) in_helpers.tplthat:| intfilterapplication.tplvalues.renderservice.portsconfiguration invalues.yamlusing template expressionSolution
The helper function takes the rules from values.yaml, renders any template expressions using
application.tplvalues.render, then parses the YAML and iterates through each rule. When outputting backendRefs, it explicitly casts the port field to integer:port: {{ .port | int }}. This ensures that even if the port comes from a template expression (which returns a string), it's converted to an integer in the final rendered output.The port value now dynamically picks up the first service port (
{{ (first $.Values.service.ports).port }}) while rendering as an integer type.Testing
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.