Skip to content

[dashboard] Show service LB IP - #1524

Merged
Timofei Larkin (lllamnyp) merged 1 commit into
mainfrom
fix/display-lb-ip
Oct 16, 2025
Merged

Timofei Larkin (lllamnyp) merged 1 commit into
mainfrom
fix/display-lb-ip

Conversation

@lllamnyp

@lllamnyp Timofei Larkin (lllamnyp) commented Oct 16, 2025 •

Copy link
Copy Markdown
Member

Fix an incorrect JSON path that prevented Service LoadBalancer IPs from rendering in the table view.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected LoadBalancerIP column to display the actual load balancer ingress IP from status information instead of configuration values.

Fix an incorrect JSON path that prevented Service LoadBalancer IPs from
rendering in the table view.

Signed-off-by: Timofei Larkin <[email protected]>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello Timofei Larkin (@lllamnyp), I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue in the dashboard where Service LoadBalancer IPs were not being rendered correctly. The change involves updating a specific JSON path used to fetch these IPs, ensuring that the dashboard now accurately displays the LoadBalancer IP addresses for services, thereby improving the visibility and usability of service information.

Highlights

  • Dashboard Display Fix: Corrected an incorrect JSON path that was preventing Service LoadBalancer IPs from being displayed in the dashboard's table view.
  • JSON Path Update: The JSON path for 'LoadbalancerIP' was updated from '.spec.loadBalancerIP' to '.status.loadBalancer.ingress[0].ip' to accurately retrieve the IP address.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Oct 16, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

LoadBalancerIP field source for two CustomColumnsOverride entries in a dashboard configuration file was modified from the spec field to the status load balancer ingress IP field.

Changes

Cohort / File(s) Summary
Dashboard LoadBalancerIP Configuration Update
internal/controller/dashboard/static_refactored.go
Modified two CustomColumnsOverride entries to source LoadBalancerIP from .status.loadBalancer.ingress[0].ip instead of .spec.loadBalancerIP, changing the data retrieval location for the LoadBalancerIP column

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 From spec to status, the IP did hop,
Through ingress arrays, the data won't stop,
A path that was shifted, a source that was moved,
The dashboard's display was gracefully grooved! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "[dashboard] Show service LB IP" directly aligns with the primary objective of the pull request, which is to fix an incorrect JSON path that prevented Service LoadBalancer IPs from rendering in the dashboard table view. The change specifically modifies the data source for LoadBalancerIP columns from an incorrect spec field to the proper status.loadBalancer.ingress[0].ip path. The title is concise, clear, and uses descriptive terminology that accurately captures the user-facing outcome of enabling LoadBalancer IP visibility in the dashboard.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/display-lb-ip

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request corrects the JSON path for retrieving the Service LoadBalancer IP in the dashboard's table view. The change from .spec.loadBalancerIP to .status.loadBalancer.ingress[0].ip is a good fix, as the assigned IP is in the service's status. However, I've noted a potential issue where a load balancer might provide a hostname instead of an IP, which the current path does not account for. I've added a comment with a suggestion to make this more robust.

createCustomColumnWithJsonPath("Name", ".metadata.name", "S", "service", getColorForType("service"), "/openapi-ui/{2}/{reqsJsonPath[0]['.metadata.namespace']['-']}/factory/kube-service-details/{reqsJsonPath[0]['.metadata.name']['-']}"),
createStringColumn("ClusterIP", ".spec.clusterIP"),
createStringColumn("LoadbalancerIP", ".spec.loadBalancerIP"),
createStringColumn("LoadbalancerIP", ".status.loadBalancer.ingress[0].ip"),

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.

medium

This change correctly points to the service status to get the load balancer ingress information. However, a LoadBalancerIngress can have either an ip or a hostname. This JSON path only considers the ip field. If the load balancer provides a hostname (e.g., on AWS), this field will be empty.

Consider using a more robust way to display the ingress point, which could be either an IP or a hostname. Perhaps a custom column component could handle this logic by checking for .ip first, and then falling back to .hostname if ip is not present.

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af96e3d and 85c9da5.

📒 Files selected for processing (1)
  • internal/controller/dashboard/static_refactored.go (1 hunks)
⏰ 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). (1)
  • GitHub Check: Build

createCustomColumnWithJsonPath("Name", ".metadata.name", "S", "service", getColorForType("service"), "/openapi-ui/{2}/{reqsJsonPath[0]['.metadata.namespace']['-']}/factory/kube-service-details/{reqsJsonPath[0]['.metadata.name']['-']}"),
createStringColumn("ClusterIP", ".spec.clusterIP"),
createStringColumn("LoadbalancerIP", ".spec.loadBalancerIP"),
createStringColumn("LoadbalancerIP", ".status.loadBalancer.ingress[0].ip"),

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.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Verify consistency with line 137.

The change correctly uses .status.loadBalancer.ingress[0].ip instead of the deprecated .spec.loadBalancerIP field. However, line 137 in the "factory-details-v1.services" CustomColumnsOverride still uses .spec.loadBalancerIP. For consistency, both table views should reference the same field.

Run the following script to verify if line 137 should also be updated:


🏁 Script executed:

#!/bin/bash
# Description: Check if line 137 needs the same fix as line 145

# Display the inconsistent usage
echo "=== Line 137 (unchanged) ==="
rg -n "factory-details-v1.services" -A 5 internal/controller/dashboard/static_refactored.go | grep -A 1 "LoadbalancerIP"

echo ""
echo "=== Line 145 (changed) ==="
rg -n "stock-namespace-/v1/services" -A 5 internal/controller/dashboard/static_refactored.go | grep -A 1 "LoadbalancerIP"

echo ""
echo "=== Other LoadBalancer IP usages ==="
rg -n "loadBalancer.ingress\[0\]" internal/controller/dashboard/static_refactored.go

Length of output: 1014


Replace .spec.loadBalancerIP with .status.loadBalancer.ingress[0].ip at line 137

  • Update createStringColumn("LoadbalancerIP", ".spec.loadBalancerIP") →
    createStringColumn("LoadbalancerIP", ".status.loadBalancer.ingress[0].ip")
  • (Optional) Add null-safety for ingress[0] and consider a fallback to
    .status.loadBalancer.ingress[0].hostname for hostname-only LoadBalancers
🤖 Prompt for AI Agents
In internal/controller/dashboard/static_refactored.go around line 145, replace
the existing LoadbalancerIP column path `.spec.loadBalancerIP` with the status
path `.status.loadBalancer.ingress[0].ip`; update
createStringColumn("LoadbalancerIP", ".spec.loadBalancerIP") to use
".status.loadBalancer.ingress[0].ip", add null-safety checks to avoid panics
when ingress or ingress[0] is missing, and implement a fallback to
`.status.loadBalancer.ingress[0].hostname` when ip is empty or absent so
hostname-only LoadBalancers still show a value.

@lllamnyp
Timofei Larkin (lllamnyp) merged commit 466f0fe into main Oct 16, 2025
53 of 56 checks passed
@lllamnyp
Timofei Larkin (lllamnyp) deleted the fix/display-lb-ip branch October 16, 2025 13:35
@lllamnyp Timofei Larkin (lllamnyp) added the kind/backport Categorizes issue or PR as requiring a backport to the current release line label Oct 16, 2025
Timofei Larkin (lllamnyp) added a commit that referenced this pull request Oct 16, 2025
Fix an incorrect JSON path that prevented Service LoadBalancer IPs from
rendering in the table view.

(cherry picked from commit 466f0fe)
Signed-off-by: Timofei Larkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/backport Categorizes issue or PR as requiring a backport to the current release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants