{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6480","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6480/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6480/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6480/events","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/issues/6480","id":66690503,"number":6480,"title":"Watch of individual objects is effectively broken","user":{"login":"invino4","id":11217472,"avatar_url":"https://avatars.githubusercontent.com/u/11217472?v=3","gravatar_id":"","url":"https://api.github.com/users/invino4","html_url":"https://github.com/invino4","followers_url":"https://api.github.com/users/invino4/followers","following_url":"https://api.github.com/users/invino4/following{/other_user}","gists_url":"https://api.github.com/users/invino4/gists{/gist_id}","starred_url":"https://api.github.com/users/invino4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/invino4/subscriptions","organizations_url":"https://api.github.com/users/invino4/orgs","repos_url":"https://api.github.com/users/invino4/repos","events_url":"https://api.github.com/users/invino4/events{/privacy}","received_events_url":"https://api.github.com/users/invino4/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/api/cluster","name":"api/cluster","color":"e1ed21"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/area/usability","name":"area/usability","color":"00cc00"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/priority/P2","name":"priority/P2","color":"fbca04"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/team/master","name":"team/master","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-04-06T19:49:56Z","updated_at":"2015-04-06T22:04:45Z","closed_at":null,"body":"Using a watch expression on endpoints can lead to unpredictable behavior that includes returning a watch stream that ignores filters (e.g. a {name} determination) and returns items of the wrong type (e.g. changes to PODS in the ENDPOINTS stream).  \r\n\r\n# Repro Steps\r\n\r\n```\r\ncurl http://localhost:8080/api/v1beta1/watch/endpoints/guestbook?namespace=default\r\n```\r\n\r\nreturns \r\n\r\n```\r\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Endpoints\",\"id\":\"kubernetes\",\"uid\":\"b0f8c701-d7df-11e4-88b2-a0481c7e9013\",\"creationTimestamp\":\"2015-03-31T19:54:07Z\",\"selfLink\":\"/api/v1beta1/endpoints/kubernetes?namespace=default\",\"resourceVersion\":7,\"apiVersion\":\"v1beta1\",\"namespace\":\"default\",\"protocol\":\"TCP\",\"endpoints\":[\"172.31.9.40:6443\"],\"subsets\":[{\"addresses\":[{\"IP\":\"172.31.9.40\"}],\"ports\":[{\"port\":6443,\"protocol\":\"TCP\"}]}]}}\r\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Endpoints\",\"id\":\"kubernetes-ro\",\"uid\":\"b0fe3434-d7df-11e4-88b2-a0481c7e9013\",\"creationTimestamp\":\"2015-03-31T19:54:07Z\",\"selfLink\":\"/api/v1beta1/endpoints/kubernetes-ro?namespace=default\",\"resourceVersion\":8,\"apiVersion\":\"v1beta1\",\"namespace\":\"default\",\"protocol\":\"TCP\",\"endpoints\":[\"172.31.9.40:7080\"],\"subsets\":[{\"addresses\":[{\"IP\":\"172.31.9.40\"}],\"ports\":[{\"port\":7080,\"protocol\":\"TCP\"}]}]}}\r\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Endpoints\",\"id\":\"redis-master\",\"uid\":\"e75b5a4e-d7f2-11e4-88b2-a0481c7e9013\",\"creationTimestamp\":\"2015-03-31T22:11:39Z\",\"selfLink\":\"/api/v1beta1/endpoints/redis-master?namespace=default\",\"resourceVersion\":4066,\"apiVersion\":\"v1beta1\",\"namespace\":\"default\",\"protocol\":\"TCP\",\"endpoints\":[\"172.17.0.17:6379\"],\"targetRefs\":[{\"endpoint\":\"172.17.0.17:6379\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"redis-master-controller-pflbd\",\"uid\":\"9d0ee66a-d7f1-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"3815\"}}],\"subsets\":[{\"addresses\":[{\"IP\":\"172.17.0.17\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"redis-master-controller-pflbd\",\"uid\":\"9d0ee66a-d7f1-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"3815\"}}],\"ports\":[{\"port\":6379,\"protocol\":\"TCP\"}]}]}}\r\n{\"type\":\"ADDED\",\"object\":{\"kind\":\"Endpoints\",\"id\":\"redis-slave\",\"uid\":\"52c784ab-d7f3-11e4-88b2-a0481c7e9013\",\"creationTimestamp\":\"2015-03-31T22:14:39Z\",\"selfLink\":\"/api/v1beta1/endpoints/redis-slave?namespace=default\",\"resourceVersion\":4178,\"apiVersion\":\"v1beta1\",\"namespace\":\"default\",\"protocol\":\"TCP\",\"endpoints\":[\"172.17.0.18:6379\",\"172.17.0.19:6379\"],\"targetRefs\":[{\"endpoint\":\"172.17.0.18:6379\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"redis-slave-controller-iebcg\",\"uid\":\"0b95b8b0-d7f3-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"4114\"}},{\"endpoint\":\"172.17.0.19:6379\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"redis-slave-controller-aiuwh\",\"uid\":\"0b95c218-d7f3-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"4122\"}}],\"subsets\":[{\"addresses\":[{\"IP\":\"172.17.0.18\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"redis-slave-controller-iebcg\",\"uid\":\"0b95b8b0-d7f3-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"4114\"}},{\"IP\":\"172.17.0.19\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"redis-slave-controller-aiuwh\",\"uid\":\"0b95c218-d7f3-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"4122\"}}],\"ports\":[{\"port\":6379,\"protocol\":\"TCP\"}]}]}}\r\n{\"type\":\"MODIFIED\",\"object\":{\"kind\":\"Endpoints\",\"id\":\"guestbook\",\"uid\":\"d036af74-d7f3-11e4-88b2-a0481c7e9013\",\"creationTimestamp\":\"2015-03-31T22:18:09Z\",\"selfLink\":\"/api/v1beta1/endpoints/guestbook?namespace=default\",\"resourceVersion\":253567,\"apiVersion\":\"v1beta1\",\"namespace\":\"default\",\"protocol\":\"TCP\",\"endpoints\":[\"172.17.0.26:3000\",\"172.17.0.30:3000\",\"172.17.0.32:3000\"],\"targetRefs\":[{\"endpoint\":\"172.17.0.26:3000\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"guestbook-controller-k5zf8\",\"uid\":\"89cc6848-d7fd-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"6422\"}},{\"endpoint\":\"172.17.0.30:3000\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"guestbook-controller-7muj6\",\"uid\":\"26e07ca5-da6d-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"137761\"}},{\"endpoint\":\"172.17.0.32:3000\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"guestbook-controller-4mot1\",\"uid\":\"933d82a7-dc93-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"253562\"}}],\"subsets\":[{\"addresses\":[{\"IP\":\"172.17.0.26\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"guestbook-controller-k5zf8\",\"uid\":\"89cc6848-d7fd-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"6422\"}},{\"IP\":\"172.17.0.30\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"guestbook-controller-7muj6\",\"uid\":\"26e07ca5-da6d-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"137761\"}},{\"IP\":\"172.17.0.32\",\"targetRef\":{\"kind\":\"Pod\",\"namespace\":\"default\",\"name\":\"guestbook-controller-4mot1\",\"uid\":\"933d82a7-dc93-11e4-88b2-a0481c7e9013\",\"resourceVersion\":\"253562\"}}],\"ports\":[{\"port\":3000,\"protocol\":\"TCP\"}]}]}}\r\n```\r\n\r\nThis result includes updates for services \"kubernetes\", \"kubernetes-ro\", \"redis-slave\", \"redis-master\", etc.  Even though the requesting URL indicated only \"guestbook\" updates were to be watched.\r\n\r\nThis seems to only occur when no resourceVersion is specified and the most recent resourceVersion has fallen off the etcd watch window.\r\n\r\n# Expected Behavior\r\nThe expected behavior when resourceVersion is not specified I would think should be either:\r\n  1.  an initial update with the latest version of the resource, followed by filtered updates.\r\n  2.  nothing, followed by filtered updates.\r\n\r\nThough I'm not sure which of these is actually the spec.  I would prefer (1) since it allows you to do a resource watch without having to first do a separate GET.  But (2) coupled with a preceding GET would yield the same results."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments/90258666","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/issues/6480#issuecomment-90258666","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6480","id":90258666,"user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T22:04:45Z","updated_at":"2015-04-06T22:04:45Z","body":"resourceVersion=0 is the same thing as saying watch resourceVersion=ObjectModifiedResourceVersion-1.  Perhaps it should be more explicit, but it is generally useful.  Why is blind watch bad?\n\n----- Original Message -----\n> Watching with resourceVersion=0 should return an error, IMO.\n> \n> ---\n> Reply to this email directly or view it on GitHub:\n> https://github.com/GoogleCloudPlatform/kubernetes/issues/6480#issuecomment-90241358\n"}}