{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4757","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4757/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4757/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4757/events","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/issues/4757","id":58677399,"number":4757,"title":"assignPod does not validate that the pod actually exists","user":{"login":"jdef","id":2348332,"avatar_url":"https://avatars.githubusercontent.com/u/2348332?v=3","gravatar_id":"","url":"https://api.github.com/users/jdef","html_url":"https://github.com/jdef","followers_url":"https://api.github.com/users/jdef/followers","following_url":"https://api.github.com/users/jdef/following{/other_user}","gists_url":"https://api.github.com/users/jdef/gists{/gist_id}","starred_url":"https://api.github.com/users/jdef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdef/subscriptions","organizations_url":"https://api.github.com/users/jdef/orgs","repos_url":"https://api.github.com/users/jdef/repos","events_url":"https://api.github.com/users/jdef/events{/privacy}","received_events_url":"https://api.github.com/users/jdef/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/kind/bug","name":"kind/bug","color":"ff0000"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/priority/P1","name":"priority/P1","color":"eb6420"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/team/master","name":"team/master","color":"d2b48c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-24T00:57:12Z","updated_at":"2015-02-24T20:09:59Z","closed_at":"2015-02-24T20:09:59Z","body":"There is a small window of time in scheduling, during which a pod may be deleted before it's actually bound. This causes zombie pods to be created in the registry. I've actually managed to accumulate a few of them since my scheduler implementation actually makes this window bigger than the default k8s implementation. The result looks something like this (the Unknown's at the top):\r\n\r\n```shell\r\n$ ./bin/kubecfg list pods\r\nName                                   Image(s)            Host                        Labels              Status\r\n----------                             ----------          ----------                  ----------          ----------\r\n                                                           10.150.52.19/10.150.52.19                       Unknown\r\n                                                           10.150.52.19/10.150.52.19                       Unknown\r\n                                                           10.150.52.19/10.150.52.19                       Unknown\r\n                                                           10.150.52.19/10.150.52.19                       Unknown\r\nf6bfc393-bbb7-11e4-994e-42010adf71e3   jdef/redis-slave    10.72.72.178/10.72.72.178   name=redisslave     Running\r\n```\r\n\r\nThey cannot be deleted programmatically because they don't have ID's when they're enumerated in a pod list.\r\n\r\nTo reproduce this condition:\r\n```shell\r\n# bind a bogus pod that doesn't exist in the registry yet\r\n$ curl http://$servicehost:8888/api/v1beta1/bindings -XPOST \\\r\n  -d'{\"namespace\":\"default\",\"podID\":\"jamesid2\",\"host\":\"10.150.52.19\",\"kind\":\"Binding\",\r\n      \"selfLink\":\"/api/v1beta1/bindings/jamesid1\"}'\r\n{\r\n  \"kind\": \"Status\",\r\n  \"creationTimestamp\": null,\r\n  \"selfLink\": \"/api/v1beta1/bindings\",\r\n  \"apiVersion\": \"v1beta1\",\r\n  \"status\": \"Success\"\r\n}\r\n\r\n# look for pods in the registry, without uid's, that reference the prior bound podID\r\n$ curl -s -f http://$servicehost:4001/v2/keys/registry/pods/default | sed -e 's/{\"key/\\n&/g' | \\\r\n   grep -v -e '\"uid' | grep -e 'default/'|grep -e james\r\n{\"key\":\"/registry/pods/default/jamesid2\",\"value\":\"{\\\"kind\\\":\\\"Pod\\\",\\\"creationTimestamp\\\":null,\\\"apiVersion\\\":\\\"v1beta1\\\",\\\"desiredState\\\":{\\\"manifest\\\":{\\\"version\\\":\\\"v1beta2\\\",\\\"id\\\":\\\"\\\",\\\"volumes\\\":null,\\\"containers\\\":null,\\\"restartPolicy\\\":{}}},\\\"currentState\\\":{\\\"manifest\\\":{\\\"version\\\":\\\"\\\",\\\"id\\\":\\\"\\\",\\\"volumes\\\":null,\\\"containers\\\":null,\\\"restartPolicy\\\":{}},\\\"host\\\":\\\"10.150.52.19\\\"}}\",\"modifiedIndex\":2587229,\"createdIndex\":2587229},\r\n```\r\n\r\nI executed this against kubernetes 0.8.x, but even after reviewing the code from the 0.11.x tag I don't see any validation that would fix this problem."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments/75835484","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/issues/4757#issuecomment-75835484","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/4757","id":75835484,"user":{"login":"vishh","id":7063592,"avatar_url":"https://avatars.githubusercontent.com/u/7063592?v=3","gravatar_id":"","url":"https://api.github.com/users/vishh","html_url":"https://github.com/vishh","followers_url":"https://api.github.com/users/vishh/followers","following_url":"https://api.github.com/users/vishh/following{/other_user}","gists_url":"https://api.github.com/users/vishh/gists{/gist_id}","starred_url":"https://api.github.com/users/vishh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishh/subscriptions","organizations_url":"https://api.github.com/users/vishh/orgs","repos_url":"https://api.github.com/users/vishh/repos","events_url":"https://api.github.com/users/vishh/events{/privacy}","received_events_url":"https://api.github.com/users/vishh/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T20:09:59Z","updated_at":"2015-02-24T20:09:59Z","body":"Closing this issue. @jdef lets use #3950 for further discussions."}}