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

Move WatchCache to pkg/storage and make it private #12848

Merged
merged 2 commits into from
Sep 3, 2015

Conversation

wojtek-t
Copy link
Member

This is a follow-up PR from discussion in #12721

The purpose of this PR is:
(1) change the reflector.go so that it doesn't have any reference to WatchCache
(2) make WatchCache to be a private class in pkg/storage (in fact it's just implementation detail)

However to do (1) I need to change the signature of Store::Replace() function to take resourceVersion as an additional argument (we need it for correctness in WatchCache).
I think this change is fine, because we use the store implementations together with Reflector (which already has a notion of resourceVersion) - the only places where we need to explicitly pass the some resource version are tests - I didn't have to modify any "production" code.

@bprashanth @timothysc

@k8s-bot
Copy link

k8s-bot commented Aug 18, 2015

GCE e2e build/test passed for commit ffda1b2ffbd9427bdab06ff93be2034631065b8f.

@k8s-bot
Copy link

k8s-bot commented Aug 19, 2015

GCE e2e build/test failed for commit 7974824e5adde4b9298e27c9f1a53ed1e187e965.

@wojtek-t wojtek-t force-pushed the private_watch_cache branch from 7974824 to 4cdd35b Compare August 19, 2015 07:08
@k8s-bot
Copy link

k8s-bot commented Aug 19, 2015

GCE e2e build/test passed for commit 4cdd35b8d2f8c0058b8873d0b24b1b2f9a98a73f.

@bprashanth
Copy link
Contributor

Can you justify this in the pr description? I guess I'm missing some context. I prefer a local hack to a global change at the interface level. Something like thread safe store should really not have to care about resource version, it should just be a locked hash map. Everyone who wants to use a locked cached would have to deal with this etcd style vector clock notation.

@wojtek-t wojtek-t force-pushed the private_watch_cache branch from 4cdd35b to 90732b6 Compare August 20, 2015 07:17
@wojtek-t
Copy link
Member Author

The purpose of this PR is:
(1) change the reflector.go so that it doesn't have any reference to WatchCache
(2) make WatchCache to be a private class in pkg/storage (in fact it's just implementation detail)

However to do (1) I need to change the signature of Store::Replace() function to take resourceVersion as an additional argument (we need it for correctness in WatchCache).
I think this change is fine, because we use the store implementations together with Reflector (which already has a notion of resourceVersion) - the only places where we need to explicitly pass the some resource version are tests - I didn't have to modify any "production" code.

@wojtek-t
Copy link
Member Author

@bprashanth - I extended the PR description with explanation of what I'm doing.

PTAL

@k8s-bot
Copy link

k8s-bot commented Aug 20, 2015

GCE e2e build/test passed for commit 90732b6b04f806ec89f0cb2519574819335e7d2e.

@wojtek-t wojtek-t force-pushed the private_watch_cache branch from 90732b6 to 6dba23b Compare August 24, 2015 11:33
@wojtek-t
Copy link
Member Author

@bprashanth - friendly ping - PTAL

cc @lavalamp [for opinion about it]

@k8s-bot
Copy link

k8s-bot commented Aug 24, 2015

GCE e2e build/test passed for commit 6dba23b032c380d586d7a61c878e24b456ea8080.

@bprashanth
Copy link
Contributor

(1) change the reflector.go so that it doesn't have any reference to WatchCache

Why is this important? To do it, your're changing something that has nothing to do with the reflector or watch cache, to understand a watch concept. I want to be able to use something like thread-safe-store from the kubelet or networking package as a generic map with locks. Piping through a resource version for replace is not horrible, but doesn't make sense in that context. I'd rather avoid it, but I'm not hard against it.

@wojtek-t
Copy link
Member Author

Thanks @bprashanth - I get your point (although I'm not fully convinced).

@lavalamp - can you please make the final call on that?

@@ -107,7 +107,7 @@ func TestFIFO_addUpdate(t *testing.T) {
func TestFIFO_addReplace(t *testing.T) {
f := NewFIFO(testFifoObjectKeyFunc)
f.Add(mkFifoObj("foo", 10))
f.Replace([]interface{}{mkFifoObj("foo", 15)})
f.Replace([]interface{}{mkFifoObj("foo", 15)}, "0")
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Real data probably would have rv being >= the highest RV in the list. So if that 15 is supposed to be a resource version, then the "0" should probably be at least "15"...

Copy link
Member

Choose a reason for hiding this comment

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

Missing push?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup - sorry. Should be fixed now.

@lavalamp
Copy link
Member

@bprashanth @wojtek-t I think we want to evolve these caches into things that understand our objects, eventually into write-through caches etc. So I think being more explicit about resource versions in these caches seems like a good change to me.

@wojtek-t
Copy link
Member Author

I think I agree with @lavalamp - my thinking is that in the fullness of time all those caches will be caches for "runtime.Object", which is already some dependence on resource versions. So I think it makes sense to proceed with that PR.
I will rebase it today.

@wojtek-t wojtek-t force-pushed the private_watch_cache branch from 6dba23b to f626282 Compare August 26, 2015 08:59
@wojtek-t
Copy link
Member Author

@bprashanth @lavalamp - PTAL

@k8s-bot
Copy link

k8s-bot commented Aug 26, 2015

GCE e2e build/test failed for commit f62628288b17cc1e7e70468b89c6df4cb1ed1cfb.

@wojtek-t wojtek-t force-pushed the private_watch_cache branch from f626282 to ec03f44 Compare August 27, 2015 13:40
@k8s-bot
Copy link

k8s-bot commented Aug 27, 2015

GCE e2e build/test passed for commit ec03f44dc3cbd6fca6db7dc048cc3ad19eda8873.

@wojtek-t
Copy link
Member Author

@lavalamp / @bprashanth - friendly ping

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 27, 2015
@k8s-github-robot
Copy link

Labelling this PR as size/L

@@ -1,86 +0,0 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Why is this removal part of this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

The poller is not used anywhere in the code.
However, it uses Replace method, which I would need to update, so I decided to just remove it.

@lavalamp
Copy link
Member

I am fine with this, just a question + nit

@wojtek-t
Copy link
Member Author

@lavalamp - PTAL

@wojtek-t
Copy link
Member Author

@lavalamp - friendly ping

@wojtek-t wojtek-t force-pushed the private_watch_cache branch from ec03f44 to d318b22 Compare August 31, 2015 07:49
@k8s-bot
Copy link

k8s-bot commented Aug 31, 2015

GCE e2e build/test passed for commit d318b22.

@wojtek-t
Copy link
Member Author

@lavalamp - PTAL

@wojtek-t
Copy link
Member Author

wojtek-t commented Sep 1, 2015

@lavalamp - friendly ping :)

1 similar comment
@wojtek-t
Copy link
Member Author

wojtek-t commented Sep 2, 2015

@lavalamp - friendly ping :)

@wojtek-t wojtek-t assigned lavalamp and unassigned bprashanth Sep 2, 2015
@lavalamp
Copy link
Member

lavalamp commented Sep 2, 2015

LGTM

@lavalamp lavalamp added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 2, 2015
@lavalamp
Copy link
Member

lavalamp commented Sep 2, 2015

Sorry for delay!

@k8s-github-robot
Copy link

@k8s-bot test this [testing build queue, sorry for the noise]

@k8s-bot
Copy link

k8s-bot commented Sep 2, 2015

GCE e2e build/test failed for commit d318b22.

@wojtek-t
Copy link
Member Author

wojtek-t commented Sep 3, 2015

Test failure is a flake:
"Services should serve a basic endpoint from pods"

@k8s-bot test this please

@k8s-bot
Copy link

k8s-bot commented Sep 3, 2015

GCE e2e build/test failed for commit d318b22.

@wojtek-t
Copy link
Member Author

wojtek-t commented Sep 3, 2015

Next flake:
Kubernetes e2e suite.Services should serve multiport endpoints from pods
Kubernetes e2e suite.Services should be able to up and down services

@k8s-bot test this please

@k8s-bot
Copy link

k8s-bot commented Sep 3, 2015

GCE e2e build/test passed for commit d318b22.

@k8s-github-robot
Copy link

@k8s-bot test this [testing build queue, sorry for the noise]

@k8s-bot
Copy link

k8s-bot commented Sep 3, 2015

GCE e2e build/test passed for commit d318b22.

@k8s-github-robot
Copy link

Automatic merge from SubmitQueue

k8s-github-robot pushed a commit that referenced this pull request Sep 3, 2015
@k8s-github-robot k8s-github-robot merged commit 5d8a604 into kubernetes:master Sep 3, 2015
@wojtek-t wojtek-t deleted the private_watch_cache branch September 7, 2015 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

6 participants