-
Notifications
You must be signed in to change notification settings - Fork 239
chore: introduce the shard template for heterogeneous shards #9491
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
Auto Cherry-pick Instructions
|
/nopick |
2d1b80d
to
b4d2dcb
Compare
ede3339
to
e79fbfa
Compare
e79fbfa
to
39a2086
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9491 +/- ##
==========================================
+ Coverage 59.51% 59.81% +0.29%
==========================================
Files 517 518 +1
Lines 55432 55913 +481
==========================================
+ Hits 32993 33445 +452
- Misses 19471 19485 +14
- Partials 2968 2983 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2d4a6da
to
88c7186
Compare
pkg/controller/sharding/types.go
Outdated
} | ||
} | ||
|
||
func (t *shardTemplate) create(generator *shardIDGenerator, shardingName string, cnt int) error { |
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.
Will the name be different? How about using generator.shardingName
directly instead of passing it via args?
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.
Done.
for i, shardingComp := range shardingCompList { | ||
if shardingComp.Name == r.ComponentName { | ||
compSpec = shardingCompList[i] | ||
return compSpec, nil |
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.
return shardingCompList[i], nil
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.
Done.
9d8f283
to
e46f393
Compare
e46f393
to
a5e98e0
Compare
func precheck(sharding *appsv1.ClusterSharding) error { | ||
shards := int32(0) | ||
shardIDs := sets.NewString() | ||
for _, tpl := range sharding.ShardTemplates { |
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.
Check the uniqueness of tpl.Name
.
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.
Done.
pkg/controller/sharding/utils.go
Outdated
|
||
func shardNamesTakeOverByTemplate(clusterName string, sharding *appsv1.ClusterSharding) []string { | ||
result := make([]string, 0) | ||
for name := range maps.Keys(shardNamesTakeOverByTemplateMap(clusterName, sharding)) { |
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.
The call to maps.Keys()
is redundant.
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.
Done.
/approve |
No description provided.