{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/66863","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/66863/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/66863/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/66863/events","html_url":"https://github.com/kubernetes/kubernetes/pull/66863","id":346580584,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NDEwMTk1","number":66863,"title":"attachdetach controller: attach volumes immediately when Pod's PVCs are bound","user":{"login":"cofyc","id":91730,"node_id":"MDQ6VXNlcjkxNzMw","avatar_url":"https://avatars3.githubusercontent.com/u/91730?v=4","gravatar_id":"","url":"https://api.github.com/users/cofyc","html_url":"https://github.com/cofyc","followers_url":"https://api.github.com/users/cofyc/followers","following_url":"https://api.github.com/users/cofyc/following{/other_user}","gists_url":"https://api.github.com/users/cofyc/gists{/gist_id}","starred_url":"https://api.github.com/users/cofyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cofyc/subscriptions","organizations_url":"https://api.github.com/users/cofyc/orgs","repos_url":"https://api.github.com/users/cofyc/repos","events_url":"https://api.github.com/users/cofyc/events{/privacy}","received_events_url":"https://api.github.com/users/cofyc/received_events","type":"User","site_admin":false},"labels":[{"id":414883982,"node_id":"MDU6TGFiZWw0MTQ4ODM5ODI=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":477397086,"node_id":"MDU6TGFiZWw0NzczOTcwODY=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":148225179,"node_id":"MDU6TGFiZWwxNDgyMjUxNzk=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/lgtm","name":"lgtm","color":"15dd18","default":false},{"id":200149833,"node_id":"MDU6TGFiZWwyMDAxNDk4MzM=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note","name":"release-note","color":"c2e0c6","default":false},{"id":169428334,"node_id":"MDU6TGFiZWwxNjk0MjgzMzQ=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/sig/storage","name":"sig/storage","color":"d2b48c","default":false},{"id":253450978,"node_id":"MDU6TGFiZWwyNTM0NTA5Nzg=","url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/L","name":"size/L","color":"ee9900","default":false}],"state":"open","locked":false,"assignee":{"login":"saad-ali","id":10052848,"node_id":"MDQ6VXNlcjEwMDUyODQ4","avatar_url":"https://avatars1.githubusercontent.com/u/10052848?v=4","gravatar_id":"","url":"https://api.github.com/users/saad-ali","html_url":"https://github.com/saad-ali","followers_url":"https://api.github.com/users/saad-ali/followers","following_url":"https://api.github.com/users/saad-ali/following{/other_user}","gists_url":"https://api.github.com/users/saad-ali/gists{/gist_id}","starred_url":"https://api.github.com/users/saad-ali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saad-ali/subscriptions","organizations_url":"https://api.github.com/users/saad-ali/orgs","repos_url":"https://api.github.com/users/saad-ali/repos","events_url":"https://api.github.com/users/saad-ali/events{/privacy}","received_events_url":"https://api.github.com/users/saad-ali/received_events","type":"User","site_admin":false},"assignees":[{"login":"saad-ali","id":10052848,"node_id":"MDQ6VXNlcjEwMDUyODQ4","avatar_url":"https://avatars1.githubusercontent.com/u/10052848?v=4","gravatar_id":"","url":"https://api.github.com/users/saad-ali","html_url":"https://github.com/saad-ali","followers_url":"https://api.github.com/users/saad-ali/followers","following_url":"https://api.github.com/users/saad-ali/following{/other_user}","gists_url":"https://api.github.com/users/saad-ali/gists{/gist_id}","starred_url":"https://api.github.com/users/saad-ali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saad-ali/subscriptions","organizations_url":"https://api.github.com/users/saad-ali/orgs","repos_url":"https://api.github.com/users/saad-ali/repos","events_url":"https://api.github.com/users/saad-ali/events{/privacy}","received_events_url":"https://api.github.com/users/saad-ali/received_events","type":"User","site_admin":false}],"milestone":null,"comments":14,"created_at":"2018-08-01T12:35:14Z","updated_at":"2018-08-14T18:02:32Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/66863","html_url":"https://github.com/kubernetes/kubernetes/pull/66863","diff_url":"https://github.com/kubernetes/kubernetes/pull/66863.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/66863.patch"},"body":"**What this PR does / why we need it**:\r\n\r\nLet attachdetach controller to attach volumes immediately when Pod's PVCs are bound.\r\n\r\nCurrent attachdetach controller calls `util.ProcessPodVolume` to add pod volumes into `desiredStateOfWorld` on these events:\r\n\r\n- podAdd event\r\n- podUpdate event\r\n- podDelete event\r\n- periodical `desiredStateOfWorldPopulator.findAndAddActivePod`\r\n\r\nBut if a pod is created with PVCs not bound, no volumes will be added into `desiredStateOfWorld` [because PVCs not bound](https://github.com/kubernetes/kubernetes/blob/v1.12.0-alpha.0/pkg/controller/volume/attachdetach/util/util.go#L99). When pv controller binds PVCs successfully, attachdetach controller will not add pod volumes immediately because it does not watch on PVC events.\r\n\r\nIt will wait until a pod update event is triggered (normally will not happen because no new status will be reported by kubelet) or `desiredStateOfWorldPopulator.findAndAddActivePod` is called (maybe 0~3 minutes later, see [timer configs](https://github.com/kubernetes/kubernetes/blob/v1.12.0-alpha.0/pkg/controller/volume/attachdetach/attach_detach_controller.go)).\r\n\r\nIn bad case, pod start time will be very long (~3 minutes + ~2 minutes (kubelet max exponential backoff)), for example: https://github.com/kubernetes/kubernetes/issues/64549#issuecomment-409440546.\r\n\r\n**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:\r\nFixes #64549\r\n\r\n**Special notes for your reviewer**:\r\n\r\n**Release note**:\r\n<!--  Write your release note:\r\n1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string \"action required\".\r\n2. If no release note is required, just write \"NONE\".\r\n-->\r\n```release-note\r\nattachdetach controller attaches volumes immediately when Pod's PVCs are bound\r\n```"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/412962811","html_url":"https://github.com/kubernetes/kubernetes/pull/66863#issuecomment-412962811","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/66863","id":412962811,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjk2MjgxMQ==","user":{"login":"redbaron","id":16624,"node_id":"MDQ6VXNlcjE2NjI0","avatar_url":"https://avatars3.githubusercontent.com/u/16624?v=4","gravatar_id":"","url":"https://api.github.com/users/redbaron","html_url":"https://github.com/redbaron","followers_url":"https://api.github.com/users/redbaron/followers","following_url":"https://api.github.com/users/redbaron/following{/other_user}","gists_url":"https://api.github.com/users/redbaron/gists{/gist_id}","starred_url":"https://api.github.com/users/redbaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbaron/subscriptions","organizations_url":"https://api.github.com/users/redbaron/orgs","repos_url":"https://api.github.com/users/redbaron/repos","events_url":"https://api.github.com/users/redbaron/events{/privacy}","received_events_url":"https://api.github.com/users/redbaron/received_events","type":"User","site_admin":false},"created_at":"2018-08-14T18:02:32Z","updated_at":"2018-08-14T18:02:32Z","author_association":"CONTRIBUTOR","body":"/retest"}}
{"actor":{"display_login":"redbaron"}}