{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/102372060","pull_request_review_id":23125248,"id":102372060,"diff_hunk":"@@ -147,10 +166,17 @@ func (c *CreateRoleOptions) Validate(f cmdutil.Factory) error {\n \t}\n \n \tfor _, r := range c.Resources {\n-\t\t_, err := mapper.ResourceFor(r)\n-\t\tif err != nil {\n+\t\tif len(r.Resource) == 0 {\n+\t\t\treturn fmt.Errorf(\"resource must be specified if apiGroup/subresource specified\")\n+\t\t}\n+\t\tif _, err := mapper.ResourceFor(schema.GroupVersionResource{Resource: r.Resource, Group: r.Group}); err != nil {\n \t\t\treturn err\n \t\t}\n+\t\tif len(r.SubResource) > 0 {\n+\t\t\tif _, err := mapper.ResourceFor(schema.GroupVersionResource{Resource: r.SubResource}); err != nil {","path":"pkg/kubectl/cmd/create_role.go","position":79,"original_position":79,"commit_id":"31a884caf1b2f77c75bd7d67c0f16f47ccebd0a2","original_commit_id":"31a884caf1b2f77c75bd7d67c0f16f47ccebd0a2","user":{"login":"liggitt","id":980082,"avatar_url":"https://avatars.githubusercontent.com/u/980082?v=3","gravatar_id":"","url":"https://api.github.com/users/liggitt","html_url":"https://github.com/liggitt","followers_url":"https://api.github.com/users/liggitt/followers","following_url":"https://api.github.com/users/liggitt/following{/other_user}","gists_url":"https://api.github.com/users/liggitt/gists{/gist_id}","starred_url":"https://api.github.com/users/liggitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liggitt/subscriptions","organizations_url":"https://api.github.com/users/liggitt/orgs","repos_url":"https://api.github.com/users/liggitt/repos","events_url":"https://api.github.com/users/liggitt/events{/privacy}","received_events_url":"https://api.github.com/users/liggitt/received_events","type":"User","site_admin":false},"body":"I don't see how this is validating what you think... without including the leading `<resource>/` bit, it can't check to see if this is actually a valid registered subresource, which means that this is probably a no-op","created_at":"2017-02-22T02:37:29Z","updated_at":"2017-02-22T02:37:29Z","html_url":"https://github.com/kubernetes/kubernetes/pull/41384#discussion_r102372060","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/102372060"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/41384#discussion_r102372060"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384","id":106046643,"html_url":"https://github.com/kubernetes/kubernetes/pull/41384","diff_url":"https://github.com/kubernetes/kubernetes/pull/41384.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/41384.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/41384","number":41384,"state":"open","locked":false,"title":"support subresource when running kubectl create role","user":{"login":"xilabao","id":22786043,"avatar_url":"https://avatars.githubusercontent.com/u/22786043?v=3","gravatar_id":"","url":"https://api.github.com/users/xilabao","html_url":"https://github.com/xilabao","followers_url":"https://api.github.com/users/xilabao/followers","following_url":"https://api.github.com/users/xilabao/following{/other_user}","gists_url":"https://api.github.com/users/xilabao/gists{/gist_id}","starred_url":"https://api.github.com/users/xilabao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilabao/subscriptions","organizations_url":"https://api.github.com/users/xilabao/orgs","repos_url":"https://api.github.com/users/xilabao/repos","events_url":"https://api.github.com/users/xilabao/events{/privacy}","received_events_url":"https://api.github.com/users/xilabao/received_events","type":"User","site_admin":false},"body":"```\r\n#kubect create role foo --verb=get,list,watch --resource=pods/status\r\nthe server doesn't have a resource type \"pods/status\"\r\n```","created_at":"2017-02-14T07:01:03Z","updated_at":"2017-02-22T02:37:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74792d1b8a389df58906324cc17b5d92b00fec90","assignee":{"login":"dims","id":23304,"avatar_url":"https://avatars.githubusercontent.com/u/23304?v=3","gravatar_id":"","url":"https://api.github.com/users/dims","html_url":"https://github.com/dims","followers_url":"https://api.github.com/users/dims/followers","following_url":"https://api.github.com/users/dims/following{/other_user}","gists_url":"https://api.github.com/users/dims/gists{/gist_id}","starred_url":"https://api.github.com/users/dims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dims/subscriptions","organizations_url":"https://api.github.com/users/dims/orgs","repos_url":"https://api.github.com/users/dims/repos","events_url":"https://api.github.com/users/dims/events{/privacy}","received_events_url":"https://api.github.com/users/dims/received_events","type":"User","site_admin":false},"assignees":[{"login":"dims","id":23304,"avatar_url":"https://avatars.githubusercontent.com/u/23304?v=3","gravatar_id":"","url":"https://api.github.com/users/dims","html_url":"https://github.com/dims","followers_url":"https://api.github.com/users/dims/followers","following_url":"https://api.github.com/users/dims/following{/other_user}","gists_url":"https://api.github.com/users/dims/gists{/gist_id}","starred_url":"https://api.github.com/users/dims/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dims/subscriptions","organizations_url":"https://api.github.com/users/dims/orgs","repos_url":"https://api.github.com/users/dims/repos","events_url":"https://api.github.com/users/dims/events{/privacy}","received_events_url":"https://api.github.com/users/dims/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/41384/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/31a884caf1b2f77c75bd7d67c0f16f47ccebd0a2","head":{"label":"xilabao:support-create-subresource","ref":"support-create-subresource","sha":"31a884caf1b2f77c75bd7d67c0f16f47ccebd0a2","user":{"login":"xilabao","id":22786043,"avatar_url":"https://avatars.githubusercontent.com/u/22786043?v=3","gravatar_id":"","url":"https://api.github.com/users/xilabao","html_url":"https://github.com/xilabao","followers_url":"https://api.github.com/users/xilabao/followers","following_url":"https://api.github.com/users/xilabao/following{/other_user}","gists_url":"https://api.github.com/users/xilabao/gists{/gist_id}","starred_url":"https://api.github.com/users/xilabao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilabao/subscriptions","organizations_url":"https://api.github.com/users/xilabao/orgs","repos_url":"https://api.github.com/users/xilabao/repos","events_url":"https://api.github.com/users/xilabao/events{/privacy}","received_events_url":"https://api.github.com/users/xilabao/received_events","type":"User","site_admin":false},"repo":{"id":70669763,"name":"kubernetes","full_name":"xilabao/kubernetes","owner":{"login":"xilabao","id":22786043,"avatar_url":"https://avatars.githubusercontent.com/u/22786043?v=3","gravatar_id":"","url":"https://api.github.com/users/xilabao","html_url":"https://github.com/xilabao","followers_url":"https://api.github.com/users/xilabao/followers","following_url":"https://api.github.com/users/xilabao/following{/other_user}","gists_url":"https://api.github.com/users/xilabao/gists{/gist_id}","starred_url":"https://api.github.com/users/xilabao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilabao/subscriptions","organizations_url":"https://api.github.com/users/xilabao/orgs","repos_url":"https://api.github.com/users/xilabao/repos","events_url":"https://api.github.com/users/xilabao/events{/privacy}","received_events_url":"https://api.github.com/users/xilabao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xilabao/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/xilabao/kubernetes","forks_url":"https://api.github.com/repos/xilabao/kubernetes/forks","keys_url":"https://api.github.com/repos/xilabao/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xilabao/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xilabao/kubernetes/teams","hooks_url":"https://api.github.com/repos/xilabao/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/xilabao/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/xilabao/kubernetes/events","assignees_url":"https://api.github.com/repos/xilabao/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/xilabao/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/xilabao/kubernetes/tags","blobs_url":"https://api.github.com/repos/xilabao/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xilabao/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xilabao/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/xilabao/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xilabao/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/xilabao/kubernetes/languages","stargazers_url":"https://api.github.com/repos/xilabao/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/xilabao/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/xilabao/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/xilabao/kubernetes/subscription","commits_url":"https://api.github.com/repos/xilabao/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/xilabao/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/xilabao/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/xilabao/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/xilabao/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/xilabao/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xilabao/kubernetes/merges","archive_url":"https://api.github.com/repos/xilabao/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xilabao/kubernetes/downloads","issues_url":"https://api.github.com/repos/xilabao/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/xilabao/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/xilabao/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/xilabao/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xilabao/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/xilabao/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/xilabao/kubernetes/deployments","created_at":"2016-10-12T06:27:15Z","updated_at":"2016-10-12T06:27:57Z","pushed_at":"2017-02-22T02:21:25Z","git_url":"git://github.com/xilabao/kubernetes.git","ssh_url":"git@github.com:xilabao/kubernetes.git","clone_url":"https://github.com/xilabao/kubernetes.git","svn_url":"https://github.com/xilabao/kubernetes","homepage":"http://kubernetes.io","size":401402,"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":"98d693e9d24f585cb4e6615efdb3d07ec3a1616b","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":"2017-02-22T02:12:13Z","pushed_at":"2017-02-22T02:21:36Z","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":557486,"stargazers_count":20822,"watchers_count":20822,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7107,"mirror_url":null,"open_issues_count":5684,"forks":7107,"open_issues":5684,"watchers":20822,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/41384"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/41384"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/41384/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/41384/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/31a884caf1b2f77c75bd7d67c0f16f47ccebd0a2"}}}}
{"actor":{"display_login":"liggitt"}}