Skip to content

fix(control-plane): default BackendURL to AMBIENT_API_SERVER_URL#1204

Merged
markturansky merged 1 commit intoalphafrom
fix/cp-credential-rolebinding-and-project-delete
Apr 3, 2026
Merged

fix(control-plane): default BackendURL to AMBIENT_API_SERVER_URL#1204
markturansky merged 1 commit intoalphafrom
fix/cp-credential-rolebinding-and-project-delete

Conversation

@markturansky
Copy link
Copy Markdown
Contributor

@markturansky markturansky commented Apr 3, 2026

Summary

The BackendURL config field defaulted to http://backend-service.ambient-code.svc:8080/api — a legacy service that no longer exists. Runner pods need BACKEND_API_URL set to call GET /credentials/{id}/token. Since AMBIENT_API_SERVER_URL is already set in all deployments, default BackendURL to it.

Discovered during E2E testing of the credential flow on OSD ambient-s0: runner logs showed DNS failures fetching credentials from the old backend URL.

Test plan

  • Runner pod logs show Successfully fetched github credentials from backend instead of DNS failure on backend-service.ambient-code.svc
  • Agent can retrieve GitHub token via /credentials/{id}/token and use it

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Backend URL configuration now uses environment variable fallback logic (BACKEND_API_URLAMBIENT_API_SERVER_URL → default to http://localhost:8000), enabling more flexible configuration across different deployment environments.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57b7f5dd-e228-42a9-b9bb-7f5745a96e88

📥 Commits

Reviewing files that changed from the base of the PR and between 7d0dc91 and 1a9e1fa.

📒 Files selected for processing (1)
  • components/ambient-control-plane/internal/config/config.go

📝 Walkthrough

Walkthrough

The control plane backend URL configuration changes from a hardcoded Kubernetes service URL to environment variable-based resolution. It now prioritizes BACKEND_API_URL, falls back to AMBIENT_API_SERVER_URL, and defaults to http://localhost:8000.

Changes

Cohort / File(s) Summary
Backend URL Configuration
components/ambient-control-plane/internal/config/config.go
Modified ControlPlaneConfig.BackendURL resolution logic to use environment variable fallback chain (BACKEND_API_URLAMBIENT_API_SERVER_URLhttp://localhost:8000) instead of hardcoded Kubernetes service URL.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows Conventional Commits format with fix type and control-plane scope; accurately describes the BackendURL configuration change.
Performance And Algorithmic Complexity ✅ Passed BackendURL initialization replaced with O(1) three-tier fallback pattern using environment variables. Single startup operation with two os.Getenv() calls. No loops, N+1 patterns, or expensive operations introduced.
Security And Secret Handling ✅ Passed PR modifies BackendURL resolution from hardcoded Kubernetes service URL to environment variable fallback. No secrets hardcoded, no injection vulnerabilities, no sensitive data exposure.
Kubernetes Resource Safety ✅ Passed PR modifies only Go configuration file; no Kubernetes manifests changed, so custom check targeting K8s resource safety is not applicable.

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

✨ 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/cp-credential-rolebinding-and-project-delete
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/cp-credential-rolebinding-and-project-delete

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.

The old default pointed at the legacy backend-service which no longer
exists. The runner needs BACKEND_API_URL to call /credentials/{id}/token;
defaulting to the API server URL means no extra env var is needed in
existing deployments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@markturansky markturansky force-pushed the fix/cp-credential-rolebinding-and-project-delete branch from 7d0dc91 to 1a9e1fa Compare April 3, 2026 23:44
@markturansky markturansky changed the title fix: credential flow follow-up fixes fix(control-plane): default BackendURL to AMBIENT_API_SERVER_URL Apr 3, 2026
@markturansky markturansky merged commit 533f368 into alpha Apr 3, 2026
34 of 36 checks passed
@markturansky markturansky deleted the fix/cp-credential-rolebinding-and-project-delete branch April 3, 2026 23:49
markturansky added a commit that referenced this pull request Apr 4, 2026
## Summary

The `BackendURL` config field defaulted to
`http://backend-service.ambient-code.svc:8080/api` — a legacy service
that no longer exists. Runner pods need `BACKEND_API_URL` set to call
`GET /credentials/{id}/token`. Since `AMBIENT_API_SERVER_URL` is already
set in all deployments, default `BackendURL` to it.

Discovered during E2E testing of the credential flow on OSD
`ambient-s0`: runner logs showed DNS failures fetching credentials from
the old backend URL.

## Test plan

- [ ] Runner pod logs show `Successfully fetched github credentials from
backend` instead of DNS failure on `backend-service.ambient-code.svc`
- [ ] Agent can retrieve GitHub token via `/credentials/{id}/token` and
use it

🤖 Generated with [Claude Code](https://claude.ai/code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Backend URL configuration now uses environment variable fallback logic
(`BACKEND_API_URL` → `AMBIENT_API_SERVER_URL` → default to
`http://localhost:8000`), enabling more flexible configuration across
different deployment environments.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Ambient Code Bot <bot@ambient-code.local>
Co-authored-by: Claude <noreply@anthropic.com>
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.

1 participant