{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/167227222","pull_request_review_id":95419128,"id":167227222,"diff_hunk":"@@ -197,3 +199,33 @@ func (a *Webhook) Dispatch(attr admission.Attributes) error {\n \t}\n \treturn a.dispatcher.Dispatch(ctx, &versionedAttr, relevantHooks)\n }\n+\n+// GetConvertor returns the versioned convertor.\n+func (a *Webhook) GetConvertor() *versioned.Convertor {","path":"staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go","position":null,"original_position":36,"commit_id":"4506179ba6d1d95f7cef2aca190e558f5accde73","original_commit_id":"8710875dbb6195f54ed591bab8c09ad19b05a27f","user":{"login":"hzxuzhonghu","id":13374016,"avatar_url":"https://avatars3.githubusercontent.com/u/13374016?v=4","gravatar_id":"","url":"https://api.github.com/users/hzxuzhonghu","html_url":"https://github.com/hzxuzhonghu","followers_url":"https://api.github.com/users/hzxuzhonghu/followers","following_url":"https://api.github.com/users/hzxuzhonghu/following{/other_user}","gists_url":"https://api.github.com/users/hzxuzhonghu/gists{/gist_id}","starred_url":"https://api.github.com/users/hzxuzhonghu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzxuzhonghu/subscriptions","organizations_url":"https://api.github.com/users/hzxuzhonghu/orgs","repos_url":"https://api.github.com/users/hzxuzhonghu/repos","events_url":"https://api.github.com/users/hzxuzhonghu/events{/privacy}","received_events_url":"https://api.github.com/users/hzxuzhonghu/received_events","type":"User","site_admin":false},"body":"Yes, most are for mock objects, except this Convertor. And we can not inject them on construction, because this generic webhook is not called directly by test case, but by mutating and validating plugins. Or we can expose these fields。","created_at":"2018-02-09T13:30:55Z","updated_at":"2018-02-09T13:30:55Z","html_url":"https://github.com/kubernetes/kubernetes/pull/59468#discussion_r167227222","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/167227222"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/59468#discussion_r167227222"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468"}},"in_reply_to_id":167222885},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468","id":167623814,"html_url":"https://github.com/kubernetes/kubernetes/pull/59468","diff_url":"https://github.com/kubernetes/kubernetes/pull/59468.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/59468.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/59468","number":59468,"state":"open","locked":false,"title":"refactor webhook admission ","user":{"login":"hzxuzhonghu","id":13374016,"avatar_url":"https://avatars3.githubusercontent.com/u/13374016?v=4","gravatar_id":"","url":"https://api.github.com/users/hzxuzhonghu","html_url":"https://github.com/hzxuzhonghu","followers_url":"https://api.github.com/users/hzxuzhonghu/followers","following_url":"https://api.github.com/users/hzxuzhonghu/following{/other_user}","gists_url":"https://api.github.com/users/hzxuzhonghu/gists{/gist_id}","starred_url":"https://api.github.com/users/hzxuzhonghu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzxuzhonghu/subscriptions","organizations_url":"https://api.github.com/users/hzxuzhonghu/orgs","repos_url":"https://api.github.com/users/hzxuzhonghu/repos","events_url":"https://api.github.com/users/hzxuzhonghu/events{/privacy}","received_events_url":"https://api.github.com/users/hzxuzhonghu/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**:\r\n\r\ndepends on #56478\r\nrefactor mutating and validating webhook admission plugins\r\n1. deduplicate mutating and validating webhook code\r\n\r\nTODO: \r\n\r\n- [x] ~refactor unit tests~\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\nNONE\r\n```\r\n","created_at":"2018-02-07T08:15:16Z","updated_at":"2018-02-09T13:30:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b278761cdb7104ea90bd3f286e29dd4b65877b3","assignee":{"login":"deads2k","id":8225098,"avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false},"assignees":[{"login":"sttts","id":730123,"avatar_url":"https://avatars0.githubusercontent.com/u/730123?v=4","gravatar_id":"","url":"https://api.github.com/users/sttts","html_url":"https://github.com/sttts","followers_url":"https://api.github.com/users/sttts/followers","following_url":"https://api.github.com/users/sttts/following{/other_user}","gists_url":"https://api.github.com/users/sttts/gists{/gist_id}","starred_url":"https://api.github.com/users/sttts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sttts/subscriptions","organizations_url":"https://api.github.com/users/sttts/orgs","repos_url":"https://api.github.com/users/sttts/repos","events_url":"https://api.github.com/users/sttts/events{/privacy}","received_events_url":"https://api.github.com/users/sttts/received_events","type":"User","site_admin":false},{"login":"deads2k","id":8225098,"avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"lavalamp","id":647318,"avatar_url":"https://avatars0.githubusercontent.com/u/647318?v=4","gravatar_id":"","url":"https://api.github.com/users/lavalamp","html_url":"https://github.com/lavalamp","followers_url":"https://api.github.com/users/lavalamp/followers","following_url":"https://api.github.com/users/lavalamp/following{/other_user}","gists_url":"https://api.github.com/users/lavalamp/gists{/gist_id}","starred_url":"https://api.github.com/users/lavalamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavalamp/subscriptions","organizations_url":"https://api.github.com/users/lavalamp/orgs","repos_url":"https://api.github.com/users/lavalamp/repos","events_url":"https://api.github.com/users/lavalamp/events{/privacy}","received_events_url":"https://api.github.com/users/lavalamp/received_events","type":"User","site_admin":false}],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/59468/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/4506179ba6d1d95f7cef2aca190e558f5accde73","head":{"label":"hzxuzhonghu:deduplicate-admission-webhooks","ref":"deduplicate-admission-webhooks","sha":"4506179ba6d1d95f7cef2aca190e558f5accde73","user":{"login":"hzxuzhonghu","id":13374016,"avatar_url":"https://avatars3.githubusercontent.com/u/13374016?v=4","gravatar_id":"","url":"https://api.github.com/users/hzxuzhonghu","html_url":"https://github.com/hzxuzhonghu","followers_url":"https://api.github.com/users/hzxuzhonghu/followers","following_url":"https://api.github.com/users/hzxuzhonghu/following{/other_user}","gists_url":"https://api.github.com/users/hzxuzhonghu/gists{/gist_id}","starred_url":"https://api.github.com/users/hzxuzhonghu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzxuzhonghu/subscriptions","organizations_url":"https://api.github.com/users/hzxuzhonghu/orgs","repos_url":"https://api.github.com/users/hzxuzhonghu/repos","events_url":"https://api.github.com/users/hzxuzhonghu/events{/privacy}","received_events_url":"https://api.github.com/users/hzxuzhonghu/received_events","type":"User","site_admin":false},"repo":{"id":99755290,"name":"kubernetes","full_name":"hzxuzhonghu/kubernetes","owner":{"login":"hzxuzhonghu","id":13374016,"avatar_url":"https://avatars3.githubusercontent.com/u/13374016?v=4","gravatar_id":"","url":"https://api.github.com/users/hzxuzhonghu","html_url":"https://github.com/hzxuzhonghu","followers_url":"https://api.github.com/users/hzxuzhonghu/followers","following_url":"https://api.github.com/users/hzxuzhonghu/following{/other_user}","gists_url":"https://api.github.com/users/hzxuzhonghu/gists{/gist_id}","starred_url":"https://api.github.com/users/hzxuzhonghu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzxuzhonghu/subscriptions","organizations_url":"https://api.github.com/users/hzxuzhonghu/orgs","repos_url":"https://api.github.com/users/hzxuzhonghu/repos","events_url":"https://api.github.com/users/hzxuzhonghu/events{/privacy}","received_events_url":"https://api.github.com/users/hzxuzhonghu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hzxuzhonghu/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/hzxuzhonghu/kubernetes","forks_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/forks","keys_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/teams","hooks_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/events","assignees_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/tags","blobs_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/languages","stargazers_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/subscription","commits_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/merges","archive_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/downloads","issues_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/hzxuzhonghu/kubernetes/deployments","created_at":"2017-08-09T02:12:15Z","updated_at":"2017-08-09T02:12:55Z","pushed_at":"2018-02-09T13:24:26Z","git_url":"git://github.com/hzxuzhonghu/kubernetes.git","ssh_url":"git@github.com:hzxuzhonghu/kubernetes.git","clone_url":"https://github.com/hzxuzhonghu/kubernetes.git","svn_url":"https://github.com/hzxuzhonghu/kubernetes","homepage":"http://kubernetes.io","size":530230,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"b922ffc491ed7016f6e8381a45633e8d0fe023ae","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","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://avatars2.githubusercontent.com/u/13629408?v=4","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":"2018-02-09T13:27:15Z","pushed_at":"2018-02-09T13:26:32Z","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":751851,"stargazers_count":32364,"watchers_count":32364,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11439,"mirror_url":null,"archived":false,"open_issues_count":5343,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":11439,"open_issues":5343,"watchers":32364,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/59468"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/59468"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/59468/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/59468/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/4506179ba6d1d95f7cef2aca190e558f5accde73"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"hzxuzhonghu"}}