Skip to content
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

fix ImageLocality plugin score is inconsistent #116938

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

olderTaoist
Copy link
Contributor

@olderTaoist olderTaoist commented Mar 27, 2023

What type of PR is this?

/kind bug

the older manner is that update the NodeInfo.ImageStates field when receive add/update/delete event, but doesn't update

ImageStates of the exist NodeInfo when receive node add event, this manner cause inconsistent of ImageLocality plugin.

the new manner is that update the cache.imageStates field when receive add/update/delete event, update ImageStates

of the exist NodeInfo according to cache.imageStates when beginning to schedule pod(in UpdateSnapshot function)

Which issue(s) this PR fixes:

Fixes #116673

Does this PR introduce a user-facing change?

Fixed inconsistency in the calculation of number of nodes that have an image, which affect the scoring in the ImageLocality plugin

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 27, 2023
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.27 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.27.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Mon Mar 27 04:26:09 UTC 2023.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 27, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: olderTaoist / name: walker (5d5958e)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 27, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @olderTaoist!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot
Copy link
Contributor

Hi @olderTaoist. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 27, 2023
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 27, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 27, 2023
@olderTaoist
Copy link
Contributor Author

olderTaoist commented Mar 27, 2023

/cc PTAL @chendave @denkensk

@k8s-ci-robot
Copy link
Contributor

@olderTaoist: GitHub didn't allow me to request PR reviews from the following users: PTAL.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @chendave @denkensk PTAL

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.

@chendave
Copy link
Member

/assign

@chendave
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 28, 2023
@olderTaoist olderTaoist force-pushed the fix-image-locality branch 2 times, most recently from 3056bf8 to 01e110d Compare March 29, 2023 01:27
Copy link
Member

@chendave chendave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another round of review, and FYI, the code freezing is approaching, I noticed you have pushed some additional commits but they are not shown up here.

@@ -433,8 +433,21 @@ func getNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffini
type ImageStateSummary struct {
// Size of the image
Size int64
// Used to track how many nodes have this image
// Used to track how many nodes have this image, It is computed from the Nodes field below
// during the execution of Snapshot.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking this might cause the inconsistency for how it is defined and used, how about remove the NumNodes field and just use len(Nodes) for where it is used? while removing it means more changes will be needed, ping @alculquicondor @ahg-g @kerthcet for thoughts.

pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Show resolved Hide resolved
pkg/scheduler/framework/types.go Outdated Show resolved Hide resolved
@olderTaoist
Copy link
Contributor Author

Another round of review, and FYI, the code freezing is approaching, I noticed you have pushed some additional commits but they are not shown up here.

i just squash commit as @ahg-g suggestion. there are no more change.

@olderTaoist
Copy link
Contributor Author

@chendave @ahg-g Does this pr need to be adjusted?

@olderTaoist
Copy link
Contributor Author

@chendave @ahg-g @alculquicondor PATL

Copy link
Member

@chendave chendave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite a long time, but I still see some pending review comments there. I'd suggest to ask for review only in case all those comments are either addressed or replied.

pkg/scheduler/framework/types.go Show resolved Hide resolved
pkg/scheduler/framework/types.go Show resolved Hide resolved
pkg/scheduler/internal/cache/cache.go Show resolved Hide resolved
pkg/scheduler/internal/cache/cache.go Show resolved Hide resolved
pkg/scheduler/internal/cache/cache.go Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
@olderTaoist
Copy link
Contributor Author

It's quite a long time, but I still see some pending review comments there. I'd suggest to ask for review only in case all those comments are either addressed or replied.

all comment addressed, i just figured out how to mark comment as addressed

Copy link
Member

@chendave chendave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM.

Ideally, the fix in pkg/scheduler/framework/types.go and the refactoring around snapshot renaming along with the removing of imageState struct should be organized in different commits, the change like this is hard to review TBH.

pls double check the logic around this comments:
https://github.com/kubernetes/kubernetes/pull/116938/files#r1249435336

/cc @kubernetes/sig-scheduling-approvers

for a double check and approval.

pkg/scheduler/framework/types.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/types.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

@chendave: GitHub didn't allow me to request PR reviews from the following users: kubernetes/sig-scheduling-approvers.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Generally LGTM.

Ideally, the fix in pkg/scheduler/framework/types.go and the refactoring around snapshot renaming along with the removing of imageState struct should be organized in different commits, the change like this is hard to review TBH.

pls double check the logic around this comments:
https://github.com/kubernetes/kubernetes/pull/116938/files#r1249435336

/cc @kubernetes/sig-scheduling-approvers

for a double check and approval.

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.

Copy link
Member

@ahg-g ahg-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, just change the DeepEqual to diff.cmp pls

pkg/scheduler/internal/cache/cache_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/cache/cache_test.go Show resolved Hide resolved
@chendave
Copy link
Member

/lgtm

thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e9bf9e42b60ee4765be46dade60b04caee81956a

@ahg-g
Copy link
Member

ahg-g commented Oct 18, 2023

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, olderTaoist

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 18, 2023
@alculquicondor
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2023
@chendave
Copy link
Member

/test pull-kubernetes-e2e-gce

@k8s-ci-robot
Copy link
Contributor

@olderTaoist: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-unit 5d5958e link unknown /test pull-kubernetes-unit

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot merged commit 78b34aa into kubernetes:master Oct 19, 2023
13 of 14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

ImageLocality scored is inaccurate during 4 minutes after scheduler startup
6 participants