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

Make list pods constant time #3083

Merged
merged 4 commits into from
Dec 22, 2014
Merged

Conversation

lavalamp
Copy link
Member

This moves all status-computing logic to the pod cache, and also starts caching more things (like whether a node exists). Will make it easier in the future to move status computation into a separate process or all the way down to kubelet.

Fixes #2951

Fixes #2975

Improves #2922

I'm having troubles running e2e. Will figure that out tomorrow and also squash.


// Clock allows for injecting fake or real clocks into
// the cache.
type Clock interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is duplicated in N places. we should really pull this out into a util. (and if you don't do that, this should probably be private.)

lastUpdate time.Time
}

type ipCache struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should really extract this out into a generic cache.

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 added a TODO.

@brendandburns
Copy link
Contributor

generally LGTM, small stuff to fix.

thx!
--brendan

* move ip cache out of registry/pod
* combine, rationalize, and move pod status logic
* Fix unit and integration tests
@lavalamp
Copy link
Member Author

Review comments addressed, going to try & run e2e now.


// Every return path from this function stores a status in the cache, even
// error cases.
defer func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't defer an anonymous function, I think it really hurts readability.

And in general this function is structured really weirdly.

How about extracting out a "constructNewStatus" function, and then only setting the status once at the end.

@brendandburns
Copy link
Contributor

Basically LGTM, modulo fixing that one last function.

@lavalamp lavalamp force-pushed the optimize branch 2 times, most recently from 8335733 to 8b588ac Compare December 22, 2014 22:55
add test for node existence cache behavior
@brendandburns
Copy link
Contributor

LGTM, will merge on green...

brendandburns added a commit that referenced this pull request Dec 22, 2014
Make list pods constant time
@brendandburns brendandburns merged commit 474cf20 into kubernetes:master Dec 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LIST pods is very slow or times out kubectl/apiserver problems if minion down
2 participants