Skip to content

128 external gateway option - #129

Merged
maxju merged 3 commits into
masterfrom
128-external-gateway-option
May 20, 2026
Merged

128 external gateway option#129
maxju merged 3 commits into
masterfrom
128-external-gateway-option

Conversation

@maxju

@maxju maxju commented May 15, 2026

Copy link
Copy Markdown
Member

#128

Summary by CodeRabbit

  • New Features

    • Added support for external Kubernetes gateways in addition to chart-managed gateways
    • New configuration options for gateway parent reference settings (name, namespace, section)
  • Refactor

    • Consolidated gateway routing logic into reusable template helpers
    • Updated all gateway route configurations to use shared helper templates for consistent gateway attachment behavior

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds Kubernetes Gateway API external gateway support to both the flame-hub and flame-node Helm charts. It introduces reusable helper templates that conditionally route HTTPRoutes to either user-provided external gateways or chart-managed defaults, along with updated configuration schemas and conditional Gateway resource rendering.

Changes

Flame Hub Gateway API External Gateway Support

Layer / File(s) Summary
Gateway parentRefs helper and configuration schema
charts/flame-hub/templates/_helpers.tpl, charts/flame-hub/values.yaml
New flame-hub.gateway.parentRefs helper conditionally emits parentRefs for external gateways (with user-provided name/namespace/sectionName) or defaults to chart-managed gateway; values schema adds gatewayClassName, external flag, and parentRef configuration block.
Gateway template conditional rendering and gatewayClassName precedence
charts/flame-hub/templates/gateway.yaml
Gateway resource is suppressed when external mode is enabled; gatewayClassName now checks new gatewayClassName field first, falling back to existing className with updated required validation.
HTTPRoute parentRefs integration across services
charts/flame-hub/templates/authup/httproute.yaml, charts/flame-hub/templates/client-ui/httproute.yaml, charts/flame-hub/templates/harbor/httproute.yaml, charts/flame-hub/templates/server-core/httproute.yaml, charts/flame-hub/templates/server-messenger/httproute.yaml, charts/flame-hub/templates/server-storage/httproute.yaml, charts/flame-hub/templates/server-telemetry/httproute.yaml
All HTTPRoute spec.parentRefs sections now use the shared helper instead of hardcoding {{ .Release.Name }}-flame-hub-gateway.

Flame Node Gateway API External Gateway Support

Layer / File(s) Summary
Gateway hostname and parentRefs helpers with configuration schema
charts/flame-node/templates/_helpers.tpl, charts/flame-node/values.yaml
New flame-node.gateway.routeHostname helper strips http:///https:// schemes; new flame-node.gateway.parentRefs helper conditionally emits parentRefs for external or chart-managed gateways; values schema adds parentRef configuration with name, namespace, and optional sectionName fields.
Gateway template conditional rendering and hostname helper use
charts/flame-node/templates/gateway.yaml
Gateway resource is suppressed when external mode is enabled; listener hostname is switched from inline regexReplaceAll to the shared flame-node.gateway.routeHostname helper.
HTTPRoute parentRefs and hostnames integration across services
charts/flame-node/templates/hub-adapter/httproute.yaml, charts/flame-node/templates/keycloak/httproute.yaml, charts/flame-node/templates/ui/httproute.yaml, charts/flame-node/templates/victoria-logs/httproute.yaml
All HTTPRoute templates now specify spec.parentRefs via the shared helper and spec.hostnames via the shared hostname helper instead of hardcoding references to {{ .Release.Name }}-node-gateway.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PrivateAIM/helm#118: Adds the initial Gateway API HTTPRoute refactoring for flame-hub by extracting hardcoded parentRefs into a reusable helper template, which directly precedes this PR's enhancement to support external gateways.

Suggested labels

hub

🐰 Gateway routes now split like a wise rabbit's burrow—
one branch leads home, t'other leads far.
External gateways welcome, defaults still there,
helpers tidy the wiring with care!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '128 external gateway option' refers to the main feature being added but is abbreviated and lacks clarity about scope—it could be more descriptive about whether this affects hub, node, or both.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 128-external-gateway-option

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/flame-node/templates/_helpers.tpl`:
- Around line 473-475: The helper flame-node.gateway.routeHostname currently
blindly runs regexReplaceAll on .Values.expose.hostname and can emit an empty
string; update it to first check that .Values.expose.hostname is non-empty
(trimmed) and that the extracted hostname passes a DNS-name validation (use
regexMatch with a DNS-safe pattern) before returning the regexReplaceAll result;
if the value is empty or fails the DNS regex, return nothing (so callers won't
render an invalid spec.hostnames entry). Use the existing helper name
flame-node.gateway.routeHostname and the symbols .Values.expose.hostname,
regexReplaceAll and regexMatch to locate and implement this conditional
validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd3c80ff-95e9-4448-8dfe-464cc6dbf2d7

📥 Commits

Reviewing files that changed from the base of the PR and between 793e119 and 872906e.

📒 Files selected for processing (17)
  • charts/flame-hub/templates/_helpers.tpl
  • charts/flame-hub/templates/authup/httproute.yaml
  • charts/flame-hub/templates/client-ui/httproute.yaml
  • charts/flame-hub/templates/gateway.yaml
  • charts/flame-hub/templates/harbor/httproute.yaml
  • charts/flame-hub/templates/server-core/httproute.yaml
  • charts/flame-hub/templates/server-messenger/httproute.yaml
  • charts/flame-hub/templates/server-storage/httproute.yaml
  • charts/flame-hub/templates/server-telemetry/httproute.yaml
  • charts/flame-hub/values.yaml
  • charts/flame-node/templates/_helpers.tpl
  • charts/flame-node/templates/gateway.yaml
  • charts/flame-node/templates/hub-adapter/httproute.yaml
  • charts/flame-node/templates/keycloak/httproute.yaml
  • charts/flame-node/templates/ui/httproute.yaml
  • charts/flame-node/templates/victoria-logs/httproute.yaml
  • charts/flame-node/values.yaml

Comment on lines +473 to +475
{{- define "flame-node.gateway.routeHostname" -}}
{{- regexReplaceAll "^https?://(.*)" .Values.expose.hostname "${1}" -}}
{{- end -}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

In Kubernetes Gateway API v1, can HTTPRoute.spec.hostnames contain an empty string, or must each entry be a valid DNS hostname?

💡 Result:

In Kubernetes Gateway API v1, each entry in HTTPRoute.spec.hostnames must be a valid DNS hostname and cannot be an empty string [1][2]. The Gateway API defines a hostname as a fully qualified domain name of a network host, as defined by RFC 1123 [2]. The field is subject to strict validation, which prohibits empty strings [3]. Specifically, the validation logic enforces a pattern that requires valid DNS labels [2][3]. While the hostnames field is optional—meaning you can omit it entirely to match all hostnames—any individual entry provided within the list must conform to the required DNS format [1][4][2]. IP addresses are also explicitly disallowed in this field [1][2].

Citations:


🏁 Script executed:

cat -n charts/flame-node/templates/_helpers.tpl | sed -n '470,500p'

Repository: PrivateAIM/helm

Length of output: 1372


🏁 Script executed:

# Search for usages of the routeHostname helper
rg "routeHostname" charts/flame-node/templates/ -n

Repository: PrivateAIM/helm

Length of output: 745


🏁 Script executed:

# Check one of the HTTPRoute files to see context of helper usage
cat -n charts/flame-node/templates/ui/httproute.yaml | head -30

Repository: PrivateAIM/helm

Length of output: 920


🏁 Script executed:

# Look for expose.hostname defaults in values files
find charts/flame-node -name "values*.yaml" -exec grep -l "expose" {} \;

Repository: PrivateAIM/helm

Length of output: 123


🏁 Script executed:

# Check the values for expose settings
rg "expose:" charts/flame-node -A 10 -B 2 | head -50

Repository: PrivateAIM/helm

Length of output: 1105


Add required hostname validation in the shared route-hostname helper.

This helper can currently return an empty string when expose.hostname is unset (defaults to "" in values.yaml), which then propagates to HTTPRoute spec.hostnames and produces invalid manifests. Per Kubernetes Gateway API v1, each hostname entry must be a valid DNS name and cannot be empty.

Suggested patch
 {{- define "flame-node.gateway.routeHostname" -}}
-{{- regexReplaceAll "^https?://(.*)" .Values.expose.hostname "${1}" -}}
+{{- $hostname := required "expose.hostname is required when expose.type=gateway" .Values.expose.hostname -}}
+{{- regexReplaceAll "^https?://(.*)" $hostname "${1}" -}}
 {{- end -}}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- define "flame-node.gateway.routeHostname" -}}
{{- regexReplaceAll "^https?://(.*)" .Values.expose.hostname "${1}" -}}
{{- end -}}
{{- define "flame-node.gateway.routeHostname" -}}
{{- $hostname := required "expose.hostname is required when expose.type=gateway" .Values.expose.hostname -}}
{{- regexReplaceAll "^https?://(.*)" $hostname "${1}" -}}
{{- end -}}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/flame-node/templates/_helpers.tpl` around lines 473 - 475, The helper
flame-node.gateway.routeHostname currently blindly runs regexReplaceAll on
.Values.expose.hostname and can emit an empty string; update it to first check
that .Values.expose.hostname is non-empty (trimmed) and that the extracted
hostname passes a DNS-name validation (use regexMatch with a DNS-safe pattern)
before returning the regexReplaceAll result; if the value is empty or fails the
DNS regex, return nothing (so callers won't render an invalid spec.hostnames
entry). Use the existing helper name flame-node.gateway.routeHostname and the
symbols .Values.expose.hostname, regexReplaceAll and regexMatch to locate and
implement this conditional validation.

@maxju maxju added deploy/preview Deploy 1 hub and 2 nodes to the preview cluster and removed deploy/preview Deploy 1 hub and 2 nodes to the preview cluster labels May 15, 2026
@maxju
maxju merged commit c6ae564 into master May 20, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request May 19, 2026
@github-actions github-actions Bot mentioned this pull request Jun 1, 2026
@maxju
maxju deleted the 128-external-gateway-option branch June 29, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy/preview Deploy 1 hub and 2 nodes to the preview cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant