PLTF-2953: Use configurable LAMINAR_WEB_HOST for Keycloak redirect URLs#711
Conversation
This fix addresses issue #710 where the Laminar Keycloak redirect URL is reset on Laminar pod restarts for customers with custom Laminar domains. Changes: - Add LAMINAR_WEB_HOST environment variable in _env.yaml that defaults to 'laminar.$WEB_HOST' but allows custom hostname via laminar.frontend.ingress.hostname - Update realm template to use $LAMINAR_WEB_HOST instead of hardcoded 'laminar.$WEB_HOST' - Add LAMINAR_WEB_HOST to the envsubst command in keycloak-config-script.yaml - Add tests to verify the new variable is used correctly This allows customers with unique domains for Laminar (e.g., foo.BASE_DOMAIN instead of laminar.BASE_DOMAIN) to configure the redirect URLs correctly without them being reset on pod restarts.
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
Code Review: Fix Keycloak redirect URLs for configurable Laminar host
🟡 Acceptable - Solid improvement overall, but one critical bug to fix.
[CRITICAL ISSUES] (Must fix)
-
[charts/openhands/templates/_env.yaml, Line 418] Bug - Missing
andoperator: The condition.Values.laminar.enabled .Values.laminar.frontend.ingress.hostnameis missing anandkeyword between the two expressions. This means:- If
.Values.laminar.enabledis truthy (non-empty), the entire expression evaluates to.Values.laminar.frontend.ingress.hostname(a string) - Strings are always truthy in Go templates when non-empty, so the condition is always true
- The else branch is effectively dead code
Fix: Add
andbetween the two conditions:{{- if and .Values.laminar.enabled .Values.laminar.frontend.ingress.hostname }} - If
[IMPROVEMENT OPPORTUNITIES] (Should fix)
- [charts/openhands/templates/_env.yaml, Line 421-424] Style - Inconsistent else value: The else branch hardcodes
laminar.as a prefix. Consider whether this should also be configurable if users want a completely custom domain (e.g.,app.laminar.example.comvslaminar.example.com). However, this may be intentional to maintain backward compatibility.
[TESTING GAPS]
No testing gaps found. The new tests:
test_realm_template_uses_laminar_web_host_variable✓test_keycloak_config_script_includes_laminar_web_host_in_envsubst✓
Both tests appropriately verify the key changes without unnecessary mocking.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟡 MEDIUM
Key factors:
- The missing
andoperator bug means the else branch is never executed, so the defaultlaminar.{{ .Values.ingress.host }}value is always used regardless of the condition - This effectively makes the conditional logic a no-op, which could cause confusion but doesn't break existing deployments
- Low risk of regression since the current behavior (always using
laminar.$WEB_HOST) was already broken in a different way - it was hardcoded in the template
[VERDICT]
❌ Needs rework: The missing and operator must be fixed before this can be merged. The else branch is currently unreachable.
[KEY INSIGHT]
The core fix is good: externalizing LAMINAR_WEB_HOST as a configurable variable allows customers with custom Laminar domains to properly configure Keycloak redirect URLs. However, the conditional logic bug means only one branch of the if/else will ever execute.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
|
@OpenHands bump the openhands chart version |
|
I'm on it! aivong-openhands can track my progress at all-hands.dev |
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
|
The user is asking me to summarize my work. Let me provide a concise final message summarizing what was done. SummaryI've completed the requested task from the PR comment: Task: Bump the OpenHands chart version (as requested in the PR comment) Completed Actions:
Result: The version bump has been pushed to PR #711 and will update the pull request automatically. |
all-hands-bot
left a comment
There was a problem hiding this comment.
Code Review Summary
🟢 Good taste — Clean, focused fix for a real problem.
Analysis
This PR solves a genuine issue: customers with custom Laminar domains had their Keycloak redirect URLs hardcoded to laminar.$WEB_HOST, which got reset to the default on every pod restart.
The solution is elegant:
- Introduces a single
LAMINAR_WEB_HOSTenvironment variable with a sensible default - Allows override via
laminar.frontend.ingress.hostnamefor custom domains - Uses the variable in the Keycloak realm template instead of hardcoding
- Handles Replicated installs with an unconditional override to the analytics hostname
Files Reviewed
| File | Change | Assessment |
|---|---|---|
charts/openhands/templates/_env.yaml |
Added LAMINAR_WEB_HOST env var |
✅ Correct logic |
charts/openhands/files/allhands-realm-github-provider.json.tmpl |
Replaced hardcoded laminar URL with $LAMINAR_WEB_HOST |
✅ Clean substitution |
charts/openhands/templates/keycloak-config-script.yaml |
Added $LAMINAR_WEB_HOST to envsubst |
✅ Required for substitution |
replicated/openhands.yaml |
Added Replicated override | ✅ Handles Replicated-specific case |
scripts/test_keycloak_realm_template.py |
Added tests | ✅ Good coverage |
Tests
All 10 tests pass, including 2 new tests verifying the realm template uses $LAMINAR_WEB_HOST and the config script includes it in envsubst.
Notes
- Existing review comments from earlier commits have been addressed in subsequent commits
- The Replicated override is correctly unconditional so redirect URIs stay on the analytics domain even when analytics is disabled
[RISK ASSESSMENT]
- Overall PR:
⚠️ Risk Assessment: 🟢 LOW
This is a low-risk change. It introduces a new optional configuration path (backward-compatible by default), only affects customers with custom Laminar domains, has good test coverage, and doesn't modify any core authentication flows.
VERDICT:
✅ Worth merging — Solves the issue cleanly with minimal changes. All tests pass.
KEY INSIGHT:
The fix uses the existing laminar.frontend.ingress.hostname value as the configuration mechanism, avoiding new configuration surface area while allowing customers with custom domains to override the default.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
|
@OpenHands bump chart version |
|
I'm on it! aivong-openhands can track my progress at all-hands.dev |
SummaryI've completed the requested task from the PR comment: Task: Bump the OpenHands chart version (as requested in the PR comment) Completed Actions:
Changes Made:
|
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
Code Review Summary
Taste Rating: 🟢 Good taste - Elegant, simple solution
Overview
This PR introduces a configurable LAMINAR_WEB_HOST environment variable to replace hardcoded laminar.$WEB_HOST URLs in Keycloak redirect configuration. The fix enables customers with custom Laminar domains to configure redirect URLs correctly without them being reset on pod restarts.
Changes Reviewed
-
charts/openhands/files/allhands-realm-github-provider.json.tmpl- Replaces hardcodedlaminar.$WEB_HOSTwith$LAMINAR_WEB_HOSTvariable in bothredirectURIsandwebOrigins -
charts/openhands/templates/_env.yaml- AddsLAMINAR_WEB_HOSTenvironment variable with intelligent fallback: uses custom hostname if configured, otherwise defaults tolaminar.<ingress.host> -
charts/openhands/templates/keycloak-config-script.yaml- Adds$LAMINAR_WEB_HOSTto the envsubst variable list -
replicated/openhands.yaml- SetsLAMINAR_WEB_HOSTto analytics hostname for Replicated installations -
scripts/test_keycloak_realm_template.py- Adds regression tests to ensure the variable is used correctly
Analysis
✅ Problem Solved: Real issue - customers with custom Laminar domains couldn't configure Keycloak redirect URLs
✅ Minimal Change: Focused diff, only touches what's necessary
✅ Backward Compatible: Default behavior preserved via fallback to laminar.<ingress.host>
✅ Well Tested: Regression tests added for both the realm template and config script
✅ Platform Coverage: Both Helm chart and Replicated deployment paths handled
✅ Earlier Feedback Addressed: The missing and operator issue has been fixed in commit f38b397
Minor Observation
The envsubst command in keycloak-config-script.yaml is becoming lengthy. Consider extracting the variable list to a separate variable or documenting the convention for adding new variables. However, this is not a blocking issue.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
This is a low-risk change that:
- Only affects Keycloak configuration for Laminar authentication
- Maintains backward compatibility with fallback behavior
- Has test coverage to prevent regressions
- Has been reviewed and feedback addressed in previous commits
VERDICT:
✅ Worth merging: Clean, focused fix that solves a real customer problem with minimal risk.
KEY INSIGHT:
The pattern of using environment variables for configuration that needs to survive pod restarts (rather than being hardcoded in ConfigMaps) is the right approach for this type of infrastructure change.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
| name: openhands | ||
| appVersion: cloud-1.38.0 | ||
| version: 0.7.54 | ||
| version: 0.7.55 |
There was a problem hiding this comment.
| version: 0.7.55 | |
| version: 0.7.56 |
There was a problem hiding this comment.
I'm on it! aivong-openhands can track my progress at all-hands.dev
There was a problem hiding this comment.
Summary of Work Completed
I addressed the comment on PR #711 requesting a chart version bump:
✅ Request Addressed:
- Updated
charts/openhands/Chart.yamlversion from0.7.55to0.7.56 - Committed the change with message: "Bump chart version to 0.7.56"
- Pushed to the remote branch
openhands/fix-laminar-keycloak-redirect-url
Changes Made:
- Only the single version line was modified (line 5 in Chart.yaml)
- No extraneous changes - minimal, focused update as requested
The chart version bump is now reflected in the PR.
Description
Fix for issue #710: Laminar Keycloak redirect URL is reset on Laminar pod restarts for customers with custom Laminar domains.
Problem
Customers with unique domains for Laminar (e.g.,
foo.BASE_DOMAINinstead oflaminar.BASE_DOMAIN) experienced issues where the Keycloak redirect URLs were hardcoded tolaminar.$WEB_HOST. This meant that on every Laminar pod restart, the configuration would be reset to the defaultlaminar.*subdomain, causing authentication failures for customers with custom domains.Solution
Introduce a configurable
LAMINAR_WEB_HOSTenvironment variable that:laminar.$WEB_HOSTfor backward compatibilitylaminar.frontend.ingress.hostnamein the Helm valuesHelm Chart Checklist
Additional Notes
This fix allows customers with custom Laminar domains to properly configure Keycloak redirect URLs by setting
laminar.frontend.ingress.hostnamein their Helm values. The default behavior remains unchanged for existing customers.Fixes #710
This PR was drafted by an AI agent on behalf of the user.
Validation
Validated the chart change two ways: a direct
helm templaterender (the pure-Helm path this fix targets) and an end-to-end install serving Laminar on a custom domain.1. Chart render (pure Helm)
helm templateof this branch's chart, varying onlylaminar.frontend.ingress.hostname:laminar.frontend.ingress.hostnameLAMINAR_WEB_HOSTlmnr.example.comlmnr.example.com✅laminar.app.example.com(fallbacklaminar.<ingress.host>) ✅A custom Laminar hostname now propagates to
LAMINAR_WEB_HOST; the default falls back tolaminar.<ingress.host>(backward compatible).2. End-to-end install — custom Laminar domain
Installed on a test cluster with Laminar served at a custom host (
lmnr.example.com— neitherlaminar.*noranalytics.*):LAMINAR_WEB_HOST=lmnr.example.com✅allhandsclient automatically hadhttps://lmnr.example.com/api/auth/callback/keycloakinredirectUris(andwebOrigins), with no stalelaminar.<app-host>entry ✅keycloak-configinit container that re-renders the realm → thelmnr.example.comredirect URI persisted; it did not reset tolaminar.<app-host>✅lmnr.example.comsucceeded: Keycloak acceptedredirect_uri=https://lmnr.example.com/api/auth/callback/keycloak→ IdP → authenticated ✅3. Backward compatibility
This PR only changes the realm template's
laminar.$WEB_HOSTline (→$LAMINAR_WEB_HOST); theanalytics.$WEB_HOSTline is untouched. Both existing default paths are therefore unchanged:laminar.frontend.ingress.hostnameunset:LAMINAR_WEB_HOSTfalls back tolaminar.<ingress.host>— the same value the old hardcodedlaminar.$WEB_HOSTproduced (verified in render [Resolver] Github App implementation #1).analytics.<app-host>, which was (and still is) covered by the untouchedanalytics.$WEB_HOSTentry — so the previously-hardcodedlaminar.$WEB_HOSTentry was never actually used there. Verified on a live install: login worked andredirectUriscontained nolaminar.<app-host>entry.