{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/89767838","pull_request_review_id":10302209,"id":89767838,"diff_hunk":"@@ -2757,47 +2757,112 @@ func WaitForPodsWithLabel(c clientset.Interface, ns string, label labels.Selecto\n \treturn\n }\n \n-// DeleteRCAndPods a Replication Controller and all pods it spawned\n-func DeleteRCAndPods(clientset clientset.Interface, internalClientset internalclientset.Interface, ns, name string) error {\n-\tBy(fmt.Sprintf(\"deleting replication controller %s in namespace %s\", name, ns))\n-\trc, err := clientset.Core().ReplicationControllers(ns).Get(name)\n+func getRuntimeObjectForKind(c clientset.Interface, kind schema.GroupKind, ns, name string) (runtime.Object, error) {\n+\tswitch kind {\n+  case api.Kind(\"ReplicationController\"):\n+\t\treturn c.Core().ReplicationControllers(ns).Get(name)\n+\tcase extensionsinternal.Kind(\"ReplicaSet\"):\n+\t\treturn c.Extensions().ReplicaSets(ns).Get(name)\n+\tcase extensionsinternal.Kind(\"Deployment\"):\n+\t\treturn c.Extensions().Deployments(ns).Get(name)\n+\tdefault:\n+    return nil, fmt.Errorf(\"Unsupported kind: %v\", kind)\n+  }\n+}\n+\n+func deleteResource(c clientset.Interface, kind schema.GroupKind, ns, name string, deleteOption *v1.DeleteOptions) error {\n+\tswitch kind {\n+\tcase api.Kind(\"ReplicationController\"):\n+\t\treturn c.Core().ReplicationControllers(ns).Delete(name, deleteOption)\n+\tcase extensionsinternal.Kind(\"ReplicaSet\"):\n+\t\treturn c.Extensions().ReplicaSets(ns).Delete(name, deleteOption)\n+\tcase extensionsinternal.Kind(\"Deployment\"):\n+\t\treturn c.Extensions().Deployments(ns).Delete(name, deleteOption)\n+\tdefault:\n+\t\treturn fmt.Errorf(\"Unsupported kind: %v\", kind)\n+\t}\n+}\n+\n+func getSelectorFromRuntimeObject(obj runtime.Object) (*unversioned.LabelSelector, error) {\n+  switch typed := obj.(type) {\n+    case *v1.ReplicationController:\n+      return &unversioned.LabelSelector{MatchLabels: typed.Spec.Selector}, nil\n+    case *extensionsinternal.ReplicaSet:\n+      return typed.Spec.Selector, nil\n+    case *extensionsinternal.Deployment:\n+      return typed.Spec.Selector, nil\n+    default:\n+      return nil, fmt.Errorf(\"Unsupported kind: %v\", obj)\n+  }\n+}\n+\n+func getReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {\n+  switch typed := obj.(type){\n+    case *v1.ReplicationController:\n+      if typed.Spec.Replicas != nil {\n+        return *typed.Spec.Replicas, nil\n+      }\n+      return 0, nil\n+    case *extensionsinternal.ReplicaSet:\n+      return typed.Spec.Replicas, nil\n+    case *extensionsinternal.Deployment:\n+      return typed.Spec.Replicas, nil\n+    default:\n+      return -1, fmt.Errorf(\"Unsupported kind: %v\", obj)\n+  }\n+}\n+\n+// DeleteResourceAndPods deletes a given resource and all pods it spawned\n+func DeleteResourceAndPods(clientset clientset.Interface, internalClientset internalclientset.Interface, kind schema.GroupKind, ns, name string) error {\n+\tBy(fmt.Sprintf(\"deleting %v %s in namespace %s\", kind, name, ns))\n+\n+\trtObject, err := getRuntimeObjectForKind(clientset, kind, ns, name)\n \tif err != nil {\n \t\tif apierrs.IsNotFound(err) {\n-\t\t\tLogf(\"RC %s was already deleted: %v\", name, err)\n+\t\t\tLogf(\"%v %s not found: %v\", kind, name, err)\n \t\t\treturn nil\n \t\t}\n \t\treturn err\n \t}\n-\treaper, err := kubectl.ReaperForReplicationController(internalClientset.Core(), 10*time.Minute)\n-\tif err != nil {\n-\t\tif apierrs.IsNotFound(err) {\n-\t\t\tLogf(\"RC %s was already deleted: %v\", name, err)\n-\t\t\treturn nil\n-\t\t}\n-\t\treturn err\n+  selector, err := getSelectorFromRuntimeObject(rtObject)\n+  if err != nil {\n+    return err\n+  }\n+\n+\tvar reaper kubectl.Reaper\n+\tswitch kind {\n+\tcase api.Kind(\"ReplicationController\"):","path":"test/e2e/framework/util.go","position":90,"original_position":90,"commit_id":"8eea7cb7453e61ae2d0089dbc10a8c76f81e4ec1","original_commit_id":"8eea7cb7453e61ae2d0089dbc10a8c76f81e4ec1","user":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"body":"Please move this to a separate function","created_at":"2016-11-28T12:02:36Z","updated_at":"2016-11-28T12:03:14Z","html_url":"https://github.com/kubernetes/kubernetes/pull/37495#discussion_r89767838","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/89767838"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/37495#discussion_r89767838"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495","id":95333345,"html_url":"https://github.com/kubernetes/kubernetes/pull/37495","diff_url":"https://github.com/kubernetes/kubernetes/pull/37495.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/37495.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/37495","number":37495,"state":"open","locked":false,"title":"Generalize RCDeletion function in e2e/framework","user":{"login":"gmarek","id":1703842,"avatar_url":"https://avatars.githubusercontent.com/u/1703842?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarek","html_url":"https://github.com/gmarek","followers_url":"https://api.github.com/users/gmarek/followers","following_url":"https://api.github.com/users/gmarek/following{/other_user}","gists_url":"https://api.github.com/users/gmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarek/subscriptions","organizations_url":"https://api.github.com/users/gmarek/orgs","repos_url":"https://api.github.com/users/gmarek/repos","events_url":"https://api.github.com/users/gmarek/events{/privacy}","received_events_url":"https://api.github.com/users/gmarek/received_events","type":"User","site_admin":false},"body":"Required to allow generalizing Density and Load test for something else than RC.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.kubernetes.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/37495)\n<!-- Reviewable:end -->\n","created_at":"2016-11-25T17:19:43Z","updated_at":"2016-11-28T12:03:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc63299b7e493df3e12194379603f0d32b2c7cd1","assignee":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"assignees":[{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/37495/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/8eea7cb7453e61ae2d0089dbc10a8c76f81e4ec1","head":{"label":"gmarek:e2e_framework","ref":"e2e_framework","sha":"8eea7cb7453e61ae2d0089dbc10a8c76f81e4ec1","user":{"login":"gmarek","id":1703842,"avatar_url":"https://avatars.githubusercontent.com/u/1703842?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarek","html_url":"https://github.com/gmarek","followers_url":"https://api.github.com/users/gmarek/followers","following_url":"https://api.github.com/users/gmarek/following{/other_user}","gists_url":"https://api.github.com/users/gmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarek/subscriptions","organizations_url":"https://api.github.com/users/gmarek/orgs","repos_url":"https://api.github.com/users/gmarek/repos","events_url":"https://api.github.com/users/gmarek/events{/privacy}","received_events_url":"https://api.github.com/users/gmarek/received_events","type":"User","site_admin":false},"repo":{"id":30216777,"name":"kubernetes","full_name":"gmarek/kubernetes","owner":{"login":"gmarek","id":1703842,"avatar_url":"https://avatars.githubusercontent.com/u/1703842?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarek","html_url":"https://github.com/gmarek","followers_url":"https://api.github.com/users/gmarek/followers","following_url":"https://api.github.com/users/gmarek/following{/other_user}","gists_url":"https://api.github.com/users/gmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarek/subscriptions","organizations_url":"https://api.github.com/users/gmarek/orgs","repos_url":"https://api.github.com/users/gmarek/repos","events_url":"https://api.github.com/users/gmarek/events{/privacy}","received_events_url":"https://api.github.com/users/gmarek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gmarek/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/gmarek/kubernetes","forks_url":"https://api.github.com/repos/gmarek/kubernetes/forks","keys_url":"https://api.github.com/repos/gmarek/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gmarek/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gmarek/kubernetes/teams","hooks_url":"https://api.github.com/repos/gmarek/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/gmarek/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/gmarek/kubernetes/events","assignees_url":"https://api.github.com/repos/gmarek/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/gmarek/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/gmarek/kubernetes/tags","blobs_url":"https://api.github.com/repos/gmarek/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gmarek/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gmarek/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/gmarek/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gmarek/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/gmarek/kubernetes/languages","stargazers_url":"https://api.github.com/repos/gmarek/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/gmarek/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/gmarek/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/gmarek/kubernetes/subscription","commits_url":"https://api.github.com/repos/gmarek/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/gmarek/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/gmarek/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/gmarek/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/gmarek/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/gmarek/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gmarek/kubernetes/merges","archive_url":"https://api.github.com/repos/gmarek/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gmarek/kubernetes/downloads","issues_url":"https://api.github.com/repos/gmarek/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/gmarek/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/gmarek/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/gmarek/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gmarek/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/gmarek/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/gmarek/kubernetes/deployments","created_at":"2015-02-03T00:37:49Z","updated_at":"2016-01-11T10:54:59Z","pushed_at":"2016-11-28T11:54:27Z","git_url":"git://github.com/gmarek/kubernetes.git","ssh_url":"git@github.com:gmarek/kubernetes.git","clone_url":"https://github.com/gmarek/kubernetes.git","svn_url":"https://github.com/gmarek/kubernetes","homepage":"http://kubernetes.io","size":349568,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"545f749a0deb8535656ce93ac1f35a59887839bf","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2016-11-28T11:56:24Z","pushed_at":"2016-11-28T11:54:39Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":639921,"stargazers_count":18736,"watchers_count":18736,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6209,"mirror_url":null,"open_issues_count":5383,"forks":6209,"open_issues":5383,"watchers":18736,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/37495"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/37495"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/37495/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/37495/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/8eea7cb7453e61ae2d0089dbc10a8c76f81e4ec1"}}}}
{"actor":{"display_login":"wojtek-t"}}