-
Notifications
You must be signed in to change notification settings - Fork 37
bugfix: add max len check for workloadName & serviceName #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this 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 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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
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.