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

Remove CSINode from scheduler cache. #84017

Merged
merged 1 commit into from
Oct 20, 2019
Merged

Conversation

ahg-g
Copy link
Member

@ahg-g ahg-g commented Oct 16, 2019

What type of PR is this?

/kind cleanup

What this PR does / why we need it:
Remove CSINodeInfo from scheduler cache. CSINodeInfo should be read directly from informer cache. Having in the scheduler cache consumes memory and adds no value.

Which issue(s) this PR fixes:
Part of #83922

NONE

/priority important-soon
/assign @liu-cong

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 16, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 16, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 16, 2019
Copy link
Member

@Huang-Wei Huang-Wei left a comment

Choose a reason for hiding this comment

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

LGTM as (1) CSINodeInfo is not included in the internal snapshot, (2) no particular caching/indexing/filtering logic is needed in the CSI predicate.

/lgtm
/hold
in case @davidz627 has concerns.

Comment on lines 399 to 403
AddFunc: sched.onCSINodeAdd,
UpdateFunc: sched.onCSINodeUpdate,
Copy link
Member

Choose a reason for hiding this comment

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

We can directly put:

AddFunc: sched.SchedulingQueue.MoveAllToActiveQueue(),
UpdateFunc: sched.SchedulingQueue.MoveAllToActiveQueue(),

Copy link
Contributor

Choose a reason for hiding this comment

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

oh this is what i said elsewhere too
+1 to this

Copy link
Member Author

@ahg-g ahg-g Oct 17, 2019

Choose a reason for hiding this comment

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

we can't the signature is different, so has to be wrapped somehow (inline or a separate func).

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 16, 2019
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2019
var _ CSINodeInfo = &CachedCSINodeInfo{}

// CachedCSINodeInfo implements CSINodeInfoInfo
type CachedCSINodeInfo struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the API object has been renamed to CSINode (the Info is omitted)

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to be consistent with the other few interfaces defined in the same file (all suffixed with info). I agree we probably don't need any of that, but as I mentioned I would like to keep the code consistent while working on removing all of them completely.

if err := sched.SchedulerCache.AddCSINode(csiNode); err != nil {
klog.Errorf("scheduler cache AddCSINode failed: %v", err)
}

sched.SchedulingQueue.MoveAllToActiveQueue()
}

func (sched *Scheduler) onCSINodeUpdate(oldObj, newObj interface{}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we keep these stubs here now that they dont' do anything on update? If we want to just maintain sched.SchedulingQueue.MoveAllToActiveQueue() behavior all callers of these funcs should just call that function directly

Copy link
Member Author

Choose a reason for hiding this comment

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

we need to wrap them because MoveAllToActiveQueue has a different signature compared to the callbacks AddFunc and UpdateFunc.

Comment on lines 399 to 403
AddFunc: sched.onCSINodeAdd,
UpdateFunc: sched.onCSINodeUpdate,
Copy link
Contributor

Choose a reason for hiding this comment

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

oh this is what i said elsewhere too
+1 to this

@@ -172,6 +173,18 @@ type CSINodeInfo interface {
GetCSINodeInfo(nodeName string) (*storagev1beta1.CSINode, error)
}

var _ CSINodeInfo = &CachedCSINodeInfo{}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this interface should be renamed to CSINodeGetter

Copy link
Member Author

Choose a reason for hiding this comment

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

replied in the other comment.


// CachedCSINodeInfo implements CSINodeInfoInfo
type CachedCSINodeInfo struct {
storagev1beta1listers.CSINodeLister
Copy link
Contributor

Choose a reason for hiding this comment

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

why even wrap this one interface inside this struct, why not just use the CSINodeLister interface directly

this comment superscedes others

Copy link
Member Author

Choose a reason for hiding this comment

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

I am planning a cleanup PR for all "listers/getters" the scheduler defines, so lets do that there. What I wanted to do in this PR is just cleanup the cache and maintain the existing interface that other parts of the code depend on (and hence I had to define this interface temporarily).

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 17, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 17, 2019

/test pull-kubernetes-e2e-gce-100-performance

Copy link
Contributor

@liu-cong liu-cong left a comment

Choose a reason for hiding this comment

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

/lgtm with a nit.

@@ -37,6 +37,7 @@ import (
utilfeature "k8s.io/apiserver/pkg/util/feature"
corelisters "k8s.io/client-go/listers/core/v1"
storagelisters "k8s.io/client-go/listers/storage/v1"
storagev1beta1listers "k8s.io/client-go/listers/storage/v1beta1"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the alias naming is inconsistent in this file. Some are <name><version> such as storagev1, some are the reverse such as v1helper, and this one seems to be a combination. Not sure if there is a common standard in k8s but we should at least make it consistent here.

Copy link
Member Author

@ahg-g ahg-g Oct 17, 2019

Choose a reason for hiding this comment

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

done. I followed the "<version><name>" pattern.

@davidz627
Copy link
Contributor

LGTM based on comment replies. Sounds like this is the first step to a larger refactor

@ahg-g
Copy link
Member Author

ahg-g commented Oct 17, 2019

LGTM based on comment replies. Sounds like this is the first step to a larger refactor

Indeed, we will likely remove most lister wrappers we have defined in the scheduler.

@Huang-Wei
Copy link
Member

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 17, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 18, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 18, 2019

/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, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 18, 2019
@ahg-g ahg-g force-pushed the ahg-csi branch 4 times, most recently from 4f0c272 to efaed0d Compare October 18, 2019 12:38
@ahg-g
Copy link
Member Author

ahg-g commented Oct 18, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2019
@ahg-g
Copy link
Member Author

ahg-g commented Oct 19, 2019

@Huang-Wei can you please take a quick look, had to rebase

@ahg-g
Copy link
Member Author

ahg-g commented Oct 19, 2019

/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 19, 2019
@Huang-Wei
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2019
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 019b662 into kubernetes:master Oct 20, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Oct 20, 2019
@ahg-g ahg-g deleted the ahg-csi branch January 10, 2020 15:38
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. 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
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants