-
Notifications
You must be signed in to change notification settings - Fork 228
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
Index PodGroupName #1952
Index PodGroupName #1952
Conversation
Hi @gabesaba. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
/ok-to-test |
pkg/controller/jobs/pod/indexer.go
Outdated
if labelValue, labelExists := pod.GetLabels()[GroupNameLabel]; labelExists { | ||
return []string{labelValue} | ||
} | ||
return []string{} |
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 []string{} | |
return nil |
pkg/controller/jobs/pod/indexer.go
Outdated
return nil | ||
} | ||
|
||
if labelValue, labelExists := pod.GetLabels()[GroupNameLabel]; labelExists { |
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.
nit:
if labelValue, labelExists := pod.GetLabels()[GroupNameLabel]; labelExists { | |
if labelValue, exists := pod.GetLabels()[GroupNameLabel]; exists { |
variable name length should be proportional to the scope of the variable. This variable's scope is one line :)
@@ -0,0 +1,28 @@ | |||
package pod |
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.
Add copyright note
@@ -477,7 +477,13 @@ func (p *Pod) Stop(ctx context.Context, c client.Client, _ []podset.PodSetInfo, | |||
} | |||
|
|||
func SetupIndexes(ctx context.Context, indexer client.FieldIndexer) error { | |||
return jobframework.SetupWorkloadOwnerIndex(ctx, indexer, gvk) | |||
if err := SetupPodGroupNameIndex(ctx, indexer); err != 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.
Nit
if err := SetupPodGroupNameIndex(ctx, indexer); err != nil { | |
if err := indexer.IndexField(ctx, &corev1.Pod{}, PodGroupNameCacheKey, IndexPodGroupName); err != nil { |
Prefer less indirection for a one-liner
1fdbeea
to
8873d3c
Compare
8873d3c
to
bc9bdf9
Compare
/lgtm |
LGTM label has been added. Git tree hash: ac2059a3aa801b35d21df04b59ce98595eb6566c
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, gabesaba The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherry-pick release-0.6 |
@alculquicondor: new pull request created: #1953 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind cleanup |
/remove-kind cleanup |
/release-note-edit
|
What type of PR is this?
What this PR does / why we need it:
This is a hotspot when there are many pods within a namespace. Compare a 60s CPU sample, pivoting around client.List
Before:
After
Special notes for your reviewer:
Does this PR introduce a user-facing change?