bugfix: add max len check for workloadName & serviceName#58
Merged
cheyang merged 1 commit intosgl-project:mainfrom Oct 16, 2025
Merged
bugfix: add max len check for workloadName & serviceName#58cheyang merged 1 commit intosgl-project:mainfrom
cheyang merged 1 commit intosgl-project:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds DNS-compatible naming constraints and introduces a new service name format with backward compatibility.
- Add length checks to workload and service names (max 63 chars)
- Switch Service naming to s-<rbg.Name>-<role.Name> with compatibility for existing services
- Plumb a Kubernetes client into discovery ConfigBuilder and update reconciler to use the compatibility helper
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/service_utils.go | Adds GetCompatibleHeadlessServiceName to resolve old vs new Service names by checking for an existing Service. |
| pkg/reconciler/sts_reconciler.go | Uses the new compatibility helper; updates constructServiceApplyConfiguration signature to return an error; minor formatting. |
| pkg/discovery/injector.go | Passes the controller-runtime client into ConfigBuilder so it can resolve Service names. |
| pkg/discovery/config_builder.go | Updates to fetch Service name via compatibility helper; methods now return errors where appropriate. |
| pkg/discovery/config_builder_test.go | Updates tests to cover both new and old naming; injects fake client; adjusts expected addresses. |
| api/workloads/v1alpha1/helper.go | Adds 63-char truncation to workload/service names; unconditionally prefixes service name with "s-"; updates comments. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
feat: svcName changed to new format "s-rbg.Name-role.Name"
42fd2a1 to
33a65de
Compare
cheyang
reviewed
Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: svcName changed to new format "s-rbg.Name-role.Name"
Ⅰ. Motivation
bugfix: add max len check for workloadName & serviceName
Ⅱ. Modifications
bugfix: add max len check for workloadName & serviceName
feat: change serviceName in new format "s-rbg.Name-role.Name"
Ⅲ. 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
make test
VI. Special notes for reviews
Checklist
make fmt.