Skip to content

Conversation

@jordane
Copy link
Member

@jordane jordane commented Sep 4, 2025

This is needed if this service is installed in a namespace that doesn't otherwise have the middleware, since there is no current way to reference a middleware in the gateway api spec outside of the current namespace.

This is needed if this service is installed in a namespace
that doesn't otherwise have the middleware, since there is no
current way to reference a middleware in the gateway api spec
outside of the current namespace.

Signed-off-by: Jordan Evans <jevans@linuxfoundation.org>
Copilot AI review requested due to automatic review settings September 4, 2025 17:12
@jordane jordane requested a review from a team as a code owner September 4, 2025 17:12
@coderabbitai
Copy link

coderabbitai bot commented Sep 4, 2025

Walkthrough

Adds an optional Helm template and values to create two Traefik forwardAuth middlewares for Heimdall, and bumps chart version from 0.2.3 to 0.2.4. Also includes minor YAML linting comment edits in CI workflow files.

Changes

Cohort / File(s) Summary
Chart metadata bump
charts/lfx-v2-query-service/Chart.yaml
Increment chart version: 0.2.30.2.4; no other field changes.
Heimdall middleware support
charts/lfx-v2-query-service/templates/heimdall-middleware.yaml, charts/lfx-v2-query-service/values.yaml
Add conditional Traefik Middleware templates heimdall-forward-body (forwardBody: true) and heimdall (no body forward) using .Values.heimdall.url. Add values heimdall.add_middleware: false and heimdall.url: http://lfx-platform-heimdall.lfx.svc.cluster.local:4456.
CI YAML lint comments
.github/workflows/ko-build-tag.yaml, .github/workflows/license-header-check.yml
Add/adjust YAML lint-disable comments and minor formatting/whitespace changes around uses: lines; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant T as Traefik
  participant M as Middleware (Heimdall forwardAuth)
  participant H as Heimdall
  participant S as lfx-v2-query-service

  rect rgba(224,240,255,0.5)
  note over T,M: Conditional middleware path (created when heimdall.add_middleware = true)
  C->>T: HTTP request
  T->>M: forwardAuth (forwards Authorization header)
  M->>H: Auth request (optionally includes body for heimdall-forward-body)
  H-->>M: Auth allow/deny
  alt Allowed
    T->>S: Forward request
    S-->>T: Response
    T-->>C: Response
  else Denied
    T-->>C: 401/403
  end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d99de06 and 46a3fb7.

📒 Files selected for processing (3)
  • .github/workflows/ko-build-tag.yaml (4 hunks)
  • .github/workflows/license-header-check.yml (1 hunks)
  • charts/lfx-v2-query-service/values.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/ko-build-tag.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/lfx-v2-query-service/values.yaml
🔇 Additional comments (1)
.github/workflows/license-header-check.yml (1)

15-16: Remove relocation suggestion — current directive above the uses: line correctly disables that line. According to yamllint docs, a # yamllint disable-line rule:line-length comment on the line above a long line suppresses that specific line’s length check (yamllint.readthedocs.io)

Likely an incorrect or invalid review comment.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jme/LFXV2-432

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds optional Heimdall middleware configuration to the LFX V2 Query Service Helm chart, addressing namespace isolation issues where middleware resources cannot be referenced across namespaces in Gateway API specifications.

  • Added add_middleware boolean flag and url configuration option to values.yaml
  • Created new middleware template with two variants (with/without body forwarding)
  • Bumped chart version from 0.2.3 to 0.2.4

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
charts/lfx-v2-query-service/values.yaml Added configuration options for middleware creation and Heimdall URL
charts/lfx-v2-query-service/templates/heimdall-middleware.yaml New template for creating Heimdall middleware resources
charts/lfx-v2-query-service/Chart.yaml Version bump to reflect new functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@andrest50 andrest50 left a comment

Choose a reason for hiding this comment

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

I'll approve after the megalinter job passes. There's just some lint errors.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
charts/lfx-v2-query-service/values.yaml (1)

56-58: Make header behavior configurable and validate URL when enabling middleware.

  • Consider adding heimdall.authRequestHeaders and heimdall.authResponseHeaders so header pass-through isn’t hardcoded in templates. Add a guard to fail if add_middleware=true and url is empty.

Apply this diff:

 heimdall:
   enabled: true
   add_middleware: false
-  url: http://lfx-platform-heimdall.lfx.svc.cluster.local:4456
+  url: http://lfx-platform-heimdall.lfx.svc.cluster.local:4456
+  # Headers from the original request to forward to Heimdall (e.g., credentials)
+  authRequestHeaders:
+    - Authorization
+    - Cookie
+  # Headers from Heimdall’s response to propagate to the upstream request (identity/claims)
+  authResponseHeaders: []
charts/lfx-v2-query-service/templates/heimdall-middleware.yaml (4)

3-3: Gate creation on both add_middleware and enabled.

Prevents accidental creation when heimdall.enabled=false.

Apply this diff:

-{{ if .Values.heimdall.add_middleware }}
+{{- if and .Values.heimdall.enabled .Values.heimdall.add_middleware }}

16-21: Add optional TLS config and make forwardBody a value.

Provide tls.insecureSkipVerify and toggle forwardBody via values for large payload routes.

Apply this diff and wire values:

   forwardAuth:
     address: "{{ .Values.heimdall.url }}"
+    tls:
+      insecureSkipVerify: {{ default false .Values.heimdall.tlsInsecureSkipVerify }}
     authRequestHeaders:
       - Authorization
       - Cookie
-    forwardBody: true
+    forwardBody: {{ default true .Values.heimdall.forwardBody }}

22-35: DRY: reduce duplication with a named template.

Both resources differ only by name and forwardBody. Consider a define/template to render both variants.


5-9: Comment phrasing.

“parentRef requiring authentication is in the request body” is confusing. Suggest clarifying that some auth decisions may depend on request body content.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 399bd80 and d99de06.

📒 Files selected for processing (3)
  • charts/lfx-v2-query-service/Chart.yaml (1 hunks)
  • charts/lfx-v2-query-service/templates/heimdall-middleware.yaml (1 hunks)
  • charts/lfx-v2-query-service/values.yaml (2 hunks)
🔇 Additional comments (3)
charts/lfx-v2-query-service/Chart.yaml (1)

8-9: Version bump looks good.

Patch bump to 0.2.4 matches a backwards-compatible Helm addition.

charts/lfx-v2-query-service/values.yaml (1)

24-31: Check both HTTPRoute and Middleware templates set metadata.namespace to .Values.lfx.namespace.

Without explicit matching namespaces, the HTTPRoute’s extensionRef won’t resolve the Middleware under Gateway API when add_middleware=true. Please confirm each template has:

metadata:
  namespace: {{ .Values.lfx.namespace }}
charts/lfx-v2-query-service/templates/heimdall-middleware.yaml (1)

16-21: Ensure Traefik version supports forwardAuth.forwardBody
forwardAuth.forwardBody is available in Traefik v2.x and in the v3 series from v3.3 onward. Confirm your cluster is running one of these versions; otherwise upgrade Traefik or remove the forwardBody option.

Signed-off-by: Jordan Evans <jevans@linuxfoundation.org>
@jordane jordane merged commit bce0560 into main Sep 4, 2025
5 checks passed
@jordane jordane deleted the jme/LFXV2-432 branch September 4, 2025 19:15
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.

3 participants