fix: change stateful set service name to meet k8s requirements#53
fix: change stateful set service name to meet k8s requirements#53gujingit merged 4 commits intosgl-project:mainfrom
Conversation
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 ☂️ |
|
@liubing0427 Please also fix the conflict issue. Thanks. |
235a17d to
e35e80e
Compare
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
/lgtm |
Ⅰ. 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
make fmt.