Skip to content

fix: change stateful set service name to meet k8s requirements#53

Merged
gujingit merged 4 commits intosgl-project:mainfrom
liubing0427:fix/service_name
Oct 16, 2025
Merged

fix: change stateful set service name to meet k8s requirements#53
gujingit merged 4 commits intosgl-project:mainfrom
liubing0427:fix/service_name

Conversation

@liubing0427
Copy link
Copy Markdown
Contributor

@liubing0427 liubing0427 commented Oct 14, 2025

Ⅰ. Motivation

The name of a K8s Service object must be a valid RFC 1035 label name. Must start with an alphabetic character. But now the code uses the same name as rbg name,rbg name can start with numeric. When create rbg use a name start with numeric, will error.

Ⅱ. Modifications

service name use a new function

Ⅲ. Does this pull request fix one issue?

NONE

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

@codecov-commenter
Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@cheyang cheyang requested a review from gujingit October 14, 2025 11:10
Comment thread api/workloads/v1alpha1/helper.go
@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented Oct 15, 2025

@liubing0427 Please also fix the conflict issue. Thanks.

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 Kubernetes service naming issue by ensuring service names comply with RFC 1035 label requirements. When RoleBasedGroup names start with a numeric character, K8s service creation fails because service names must begin with an alphabetic character.

  • Introduces a new GetServiceName() method that prefixes numeric-starting names with "s-"
  • Updates all service name references to use the new method instead of GetWorkloadName()
  • Adds comprehensive test coverage for numeric-starting RBG names

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
api/workloads/v1alpha1/helper.go Adds GetServiceName() method with RFC 1035 compliance logic
pkg/reconciler/sts_reconciler.go Updates service reconciliation to use GetServiceName()
pkg/reconciler/sts_reconciler_test.go Adds test case for numeric-starting RBG names
pkg/discovery/config_builder.go Updates service name generation in discovery
pkg/discovery/config_builder_test.go Adds comprehensive test for numeric RBG name handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread api/workloads/v1alpha1/helper.go Outdated
Comment thread api/workloads/v1alpha1/helper.go Outdated
gujingit and others added 2 commits October 16, 2025 14:44
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@gujingit
Copy link
Copy Markdown
Collaborator

/lgtm
/approve

@gujingit gujingit merged commit 5d5d14f into sgl-project:main Oct 16, 2025
3 checks passed
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.

5 participants