Skip to content

feat: add CTRL_URL environment variable to dashboard#3980

Merged
chronark merged 1 commit intomainfrom
09-16-feat_add_ctrl_url_environment_variable_to_dashboard
Sep 17, 2025
Merged

feat: add CTRL_URL environment variable to dashboard#3980
chronark merged 1 commit intomainfrom
09-16-feat_add_ctrl_url_environment_variable_to_dashboard

Conversation

@chronark
Copy link
Collaborator

@chronark chronark commented Sep 16, 2025

What does this PR do?

Adds the CTRL_URL environment variable to the dashboard configuration in both Kubernetes manifests and local development setup. This allows the dashboard to communicate with the control plane service.

Fixes # (issue)

Type of change

  • Enhancement (small improvements)

How should this be tested?

  • Verify that the dashboard can connect to the control plane service using the provided URL
  • Test dashboard functionality that relies on control plane interactions

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read Contributing Guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand areas
  • Ran pnpm build
  • Ran pnpm fmt
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Summary by CodeRabbit

  • New Features
    • Dashboard is now exposed via a LoadBalancer service on port 3000, making it accessible externally.
    • Dashboard container now includes a control plane URL environment variable (CTRL_URL) for connectivity.
    • Local bootstrap sets CTRL_URL to http://localhost:7091; in-cluster configuration uses http://ctrl:7091.
  • Chores
    • Deployment manifest formatting and structure cleaned up without changing behavior.

@vercel
Copy link

vercel bot commented Sep 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
dashboard Ready Ready Preview Comment Sep 16, 2025 6:54pm
engineering Ready Ready Preview Comment Sep 16, 2025 6:54pm

@changeset-bot
Copy link

changeset-bot bot commented Sep 16, 2025

⚠️ No Changeset found

Latest commit: 1c840d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

📝 Walkthrough

Walkthrough

Adds a Service resource for the dashboard in Kubernetes and introduces a CTRL_URL environment variable in both Kubernetes deployment and local bootstrap script. The YAML deployment formatting is adjusted without semantic changes. The local dashboard bootstrap now writes ControlPlane.CTRL_URL to the generated environment.

Changes

Cohort / File(s) Summary
Kubernetes Dashboard Manifests
go/k8s/manifests/dashboard.yaml
Added Service (type LoadBalancer) exposing port 3000 with selector app=dashboard. Deployment YAML re-indented; container gains env var CTRL_URL=http://ctrl:7091. Probes unchanged.
Local Dev Dashboard Bootstrap
tools/local/src/cmd/dashboard.ts
bootstrapDashboard adds ControlPlane.CTRL_URL=http://localhost:7091 to env via marshalEnv; no signature or control-flow changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description provides a concise summary, marks the change type as an enhancement, includes high-level testing guidance, and shows the checklist items completed, which addresses much of the template. However the required "Fixes # (issue)" field is left as a placeholder (no issue number referenced) and the "How should this be tested?" section is high-level and lacks concrete reproducible steps or commands, so required template information is incomplete. Because a required item (the issue reference) is missing and testing instructions are underspecified, the description does not fully satisfy the repository's template. Please add or link the issue by replacing "Fixes # (issue)" with "Fixes #" (or create the issue first), and expand the testing section with concrete reproduction steps and commands (for example how to run the dashboard locally, how to set/verify CTRL_URL, sample requests and expected responses). Also attach any relevant logs or screenshots that demonstrate successful control-plane communication and, if helpful, list the exact pnpm commands you ran to satisfy the checklist. After those updates the description will match the repository template and be acceptable for merge.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: add CTRL_URL environment variable to dashboard" accurately and succinctly captures the primary change in the PR—the addition of the CTRL_URL environment variable to the dashboard configuration in both Kubernetes manifests and local development setup. It is a single clear sentence, uses a conventional "feat:" prefix, and contains no extraneous details, so a teammate scanning history will understand the main intent. Therefore it meets the repository guidance for conciseness and relevance.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 09-16-feat_add_ctrl_url_environment_variable_to_dashboard

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chronark chronark marked this pull request as ready for review September 16, 2025 18:53
@vercel vercel bot temporarily deployed to Preview – engineering September 16, 2025 18:53 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard September 16, 2025 18:54 Inactive
@github-actions
Copy link
Contributor

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

@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: 1

🧹 Nitpick comments (3)
go/k8s/manifests/dashboard.yaml (3)

22-29: Init wait loop can hang indefinitely; add timeout/backoff

An endless loop can stall rollout. Add a bounded retry with small TCP timeout.

-                      - |
-                          until nc -z planetscale 3900; do
-                            echo waiting for planetscale
-                            sleep 2
-                          done
+                      - |
+                          for i in $(seq 1 60); do
+                            if nc -z -w 2 planetscale 3900; then
+                              exit 0
+                            fi
+                            echo "waiting for planetscale"
+                            sleep 2
+                          done
+                          echo "planetscale did not become ready in time" >&2
+                          exit 1

33-33: imagePullPolicy: Never — ensure this is gated to local-only overlays

Fine for local clusters with preloaded images; risky elsewhere. Gate via an overlay or set IfNotPresent in base.


67-83: Service exposure: confirm LoadBalancer is intended

If the dashboard shouldn’t be publicly reachable in all environments, consider ClusterIP in base and promote to LoadBalancer via env-specific overlay. Also ensure auth is enforced.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 132f477 and 1c840d2.

📒 Files selected for processing (2)
  • go/k8s/manifests/dashboard.yaml (1 hunks)
  • tools/local/src/cmd/dashboard.ts (1 hunks)
🧰 Additional context used
🪛 Checkov (3.2.334)
go/k8s/manifests/dashboard.yaml

[medium] 42-43: Basic Auth Credentials

(CKV_SECRET_4)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Test API / API Test Local
  • GitHub Check: Test Go API Local / Test
  • GitHub Check: Build / Build
🔇 Additional comments (2)
go/k8s/manifests/dashboard.yaml (1)

51-52: Verified — CTRL_URL is correct (Service ctrl exists:7091 in namespace unkey)
go/k8s/manifests/ctrl.yaml defines Service metadata.name: ctrl, metadata.namespace: unkey with port: 7091 and targetPort: 7091; http://ctrl:7091 is valid for in-cluster DNS.

tools/local/src/cmd/dashboard.ts (1)

35-37: Verify CTRL_URL marshaling & consumption

  • Local default exists: tools/local/src/cmd/dashboard.ts — ControlPlane.CTRL_URL = "http://localhost:7091".
  • Dashboard reads the value via env().CTRL_URL (apps/dashboard/lib/trpc/routers/deploy/deployment/rollback.ts:23); apps/dashboard/lib/env.ts declares CTRL_URL as z.string().url().optional().
  • Verify the env generator (marshalEnv or the tool that emits the local env) flattens ControlPlane.CTRL_URL → CTRL_URL (top-level, not namespaced). If marshalEnv isn't used, identify the generator and confirm it outputs a plain CTRL_URL for the dashboard to consume.

Copy link
Member

@Flo4604 Flo4604 left a comment

Choose a reason for hiding this comment

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

I love yaml formatting

Copy link
Collaborator Author

@chronark chronark left a comment

Choose a reason for hiding this comment

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

ah well that's dumb, I thought I changed it to 2 tabs, I'll send a fix later

@chronark chronark merged commit 7972eb8 into main Sep 17, 2025
25 checks passed
@chronark chronark deleted the 09-16-feat_add_ctrl_url_environment_variable_to_dashboard branch September 17, 2025 10:17
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.

2 participants