Skip to content

fix(helm): use API Service address for NMP_BASE_URL#894

Open
svvarom wants to merge 1 commit into
mainfrom
fix-agent-base-url/smuley
Open

fix(helm): use API Service address for NMP_BASE_URL#894
svvarom wants to merge 1 commit into
mainfrom
fix-agent-base-url/smuley

Conversation

@svvarom

@svvarom svvarom commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The API pod set NMP_BASE_URL to loopback when the embedded PDP is enabled. That value is copied into agent workflow configs, which run in a separate container — where loopback resolves to the agent itself, not the platform.

Use the in-cluster API Service address instead, matching what the controller and seed job already use. The embedded PDP keeps its own loopback via NMP_AUTH_POLICY_DECISION_POINT_BASE_URL.

Adds a template test, alongside the existing ones for the controller and seed job.

Testing

  • helm template with auth on and off: NMP_BASE_URL is the Service address, PDP var still loopback
  • helm lint clean
  • New test fails without the template change, passes with it

Summary by CodeRabbit

  • Bug Fixes
    • Updated API service configuration to consistently use the internal service URL for agent configurations.
    • Preserved the loopback URL for authorization policy decision point communication.

The API pod set NMP_BASE_URL to loopback when the embedded PDP is enabled.
That value is copied into agent workflow configs, which run in a separate
container, where loopback resolves to the agent itself rather than the
platform.

Use the in-cluster API Service address instead, matching the controller and
seed job. The embedded PDP keeps its own loopback via
NMP_AUTH_POLICY_DECISION_POINT_BASE_URL.

Adds a template test alongside the existing controller and seed job ones.

Signed-off-by: Swarom Muley <smuley@nvidia.com>
@svvarom
svvarom requested review from a team as code owners July 24, 2026 20:08
@github-actions github-actions Bot added the fix label Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

API URL configuration

Layer / File(s) Summary
Internal URL assignment and validation
k8s/helm/templates/api/api-deployment.yaml, tests/auth_idp/static/test_authentik_kubernetes_demo.py
NMP_BASE_URL now always uses nemo-platform.internalBaseUrl; static tests verify it is not loopback and that the policy decision point URL still uses nemo-platform.apiLoopbackBaseUrl.

Suggested reviewers: ironcommit

🚥 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 clearly matches the main change: NMP_BASE_URL now uses the API Service address in the Helm chart.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-agent-base-url/smuley

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@tests/auth_idp/static/test_authentik_kubernetes_demo.py`:
- Around line 1181-1197: Extend
test_nemo_platform_api_uses_internal_api_service_url_for_agent_configs to render
the API deployment with authentication/PDP enabled and disabled, rather than
inspecting template text alone. Assert NMP_BASE_URL always uses the internal
service URL, while NMP_AUTH_POLICY_DECISION_POINT_BASE_URL is present only in
the enabled rendering and absent when disabled.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b2ec32e0-0bdf-4c1c-8556-c4da7829634e

📥 Commits

Reviewing files that changed from the base of the PR and between 9fa8f2a and 82bc3a7.

📒 Files selected for processing (2)
  • k8s/helm/templates/api/api-deployment.yaml
  • tests/auth_idp/static/test_authentik_kubernetes_demo.py

Comment on lines +1181 to +1197
def test_nemo_platform_api_uses_internal_api_service_url_for_agent_configs() -> None:
"""NMP_BASE_URL on the API pod must be the Service address, never loopback.

The API copies this value into agent workflow configs, which run in a different
container -- loopback there resolves to the agent itself, not the platform.
Embedded PDP gets its loopback from NMP_AUTH_POLICY_DECISION_POINT_BASE_URL instead.
"""
template = Path("k8s/helm/templates/api/api-deployment.yaml").read_text(encoding="utf-8")

assert (
'name: NMP_BASE_URL\n value: {{ include "nemo-platform.internalBaseUrl" . | quote }}'
) in template
assert "nemo-platform.apiLoopbackBaseUrl" not in template.split("NMP_AUTOMODEL")[0]
assert (
"name: NMP_AUTH_POLICY_DECISION_POINT_BASE_URL\n value: "
'{{ include "nemo-platform.apiLoopbackBaseUrl" . | quote }}'
) in template

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover both rendered authentication configurations.

This test only inspects template text; it never renders with authentication/PDP enabled and disabled. Add both render cases and assert that NMP_AUTH_POLICY_DECISION_POINT_BASE_URL is present only when enabled.

🤖 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 `@tests/auth_idp/static/test_authentik_kubernetes_demo.py` around lines 1181 -
1197, Extend
test_nemo_platform_api_uses_internal_api_service_url_for_agent_configs to render
the API deployment with authentication/PDP enabled and disabled, rather than
inspecting template text alone. Assert NMP_BASE_URL always uses the internal
service URL, while NMP_AUTH_POLICY_DECISION_POINT_BASE_URL is present only in
the enabled rendering and absent when disabled.

@svvarom svvarom self-assigned this Jul 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 27157/34869 77.9% 62.1%
Integration Tests 15962/33581 47.5% 20.0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant