Skip to content

fix: use GetWorkloadName for instance address generation#138

Merged
Syspretor merged 1 commit intosgl-project:mainfrom
bcfre:fix-dev
Jan 12, 2026
Merged

fix: use GetWorkloadName for instance address generation#138
Syspretor merged 1 commit intosgl-project:mainfrom
bcfre:fix-dev

Conversation

@bcfre
Copy link
Copy Markdown
Collaborator

@bcfre bcfre commented Jan 11, 2026

Ⅰ. Motivation

before

    roles:
      lws:
        instances:
        - address: lws-0.s-rbg-with-lws-workload-lws
        size: 1
      sts:
        instances:
        - address: sts-0.s-rbg-with-lws-workload-sts
        size: 1

after

    roles:
      lws:
        instances:
        - address: rbg-with-lws-workload-lws-0.s-rbg-with-lws-workload-lws
        size: 1
      sts:
        instances:
        - address: rbg-with-lws-workload-sts-0.s-rbg-with-lws-workload-sts
        size: 1

actual pod template

hostname: rbg-with-lws-workload-lws-0

Ⅱ. Modifications

Ⅲ. Does this pull request fix one issue?

fixes #XXXX

Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅴ. Describe how to verify it

VI. Special notes for reviews

Checklist

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @bcfre, 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 addresses an issue in the system's instance address generation. It refines how individual service instances are named and located by ensuring that a dedicated helper function is used to derive the correct workload name. This modification is critical for maintaining accurate service discovery and overall system stability, preventing potential misconfigurations or communication failures.

Highlights

  • Instance Address Generation Fix: Corrected the logic for generating instance addresses by replacing the direct use of role.Name with a call to b.rbg.GetWorkloadName(role). This ensures that the appropriate workload name is consistently used for instance addressing.
  • Improved Service Discovery Reliability: The change enhances the reliability of service discovery by ensuring that instance addresses are correctly formatted, which is crucial for proper communication and management of workload instances.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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-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-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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

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 correctly fixes the instance address generation to use the full workload name, which is necessary for creating resolvable pod DNS names. However, the PR is incomplete because the unit tests have not been updated to reflect this change, which will cause the build to fail. Please update the tests in pkg/discovery/config_builder_test.go.

Comment thread pkg/discovery/config_builder.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in instance address generation to use the full workload name (combining RoleBasedGroup name and role name) instead of just the role name. This ensures that the generated addresses correctly match the actual pod names created by the workload controllers.

Changes:

  • Updated buildInstances method to use GetWorkloadName(role) instead of role.Name for instance address generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/discovery/config_builder.go
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Syspretor
Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@Syspretor Syspretor merged commit 5f478c4 into sgl-project:main Jan 12, 2026
6 checks passed
@bcfre bcfre deleted the fix-dev branch January 12, 2026 09:03
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.

4 participants