{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/90445351","pull_request_review_id":10963070,"id":90445351,"diff_hunk":"@@ -872,7 +872,7 @@ func (e *Store) WatchPredicate(ctx api.Context, m *generic.SelectionPredicate, r\n \n \tif name, ok := m.MatchesSingle(); ok {\n \t\tif key, err := e.KeyFunc(ctx, name); err == nil {\n-\t\t\tif err != nil {\n+\t\t\tif err != nil { // TODO Dead code?","path":"vendor/k8s.io/kubernetes/pkg/registry/generic/registry/store.go","position":5,"original_position":5,"commit_id":"0e62f32711f33abce8a5bf28d1b1cdf45c9a4bec","original_commit_id":"0e62f32711f33abce8a5bf28d1b1cdf45c9a4bec","user":{"login":"soltysh","id":576341,"avatar_url":"https://avatars.githubusercontent.com/u/576341?v=3","gravatar_id":"","url":"https://api.github.com/users/soltysh","html_url":"https://github.com/soltysh","followers_url":"https://api.github.com/users/soltysh/followers","following_url":"https://api.github.com/users/soltysh/following{/other_user}","gists_url":"https://api.github.com/users/soltysh/gists{/gist_id}","starred_url":"https://api.github.com/users/soltysh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soltysh/subscriptions","organizations_url":"https://api.github.com/users/soltysh/orgs","repos_url":"https://api.github.com/users/soltysh/repos","events_url":"https://api.github.com/users/soltysh/events{/privacy}","received_events_url":"https://api.github.com/users/soltysh/received_events","type":"User","site_admin":false},"body":"Good catch, it looks like this piece of code should be:\r\n```\r\n\tif name, ok := p.MatchesSingle(); ok {\r\n\t\tkey, err := e.KeyFunc(ctx, name)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t\tw, err := e.Storage.Watch(ctx, key, resourceVersion, p)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\t\tif e.Decorator != nil {\r\n\t\t\treturn newDecoratedWatcher(w, e.Decorator), nil\r\n\t\t}\r\n\t\treturn w, nil\r\n\t\t// if we cannot extract a key based on the current context, the optimization is skipped\r\n\t}\r\n```\r\nbut I'll defer to @smarterclayton who introduced that change. ","created_at":"2016-12-01T13:26:33Z","updated_at":"2016-12-01T13:26:33Z","html_url":"https://github.com/openshift/origin/pull/11909#discussion_r90445351","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/11909","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/90445351"},"html":{"href":"https://github.com/openshift/origin/pull/11909#discussion_r90445351"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/11909"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/11909","id":93677749,"html_url":"https://github.com/openshift/origin/pull/11909","diff_url":"https://github.com/openshift/origin/pull/11909.diff","patch_url":"https://github.com/openshift/origin/pull/11909.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/11909","number":11909,"state":"open","locked":false,"title":"WIP: User Read and Delete OauthClientAuthorizations","user":{"login":"enj","id":7001223,"avatar_url":"https://avatars.githubusercontent.com/u/7001223?v=3","gravatar_id":"","url":"https://api.github.com/users/enj","html_url":"https://github.com/enj","followers_url":"https://api.github.com/users/enj/followers","following_url":"https://api.github.com/users/enj/following{/other_user}","gists_url":"https://api.github.com/users/enj/gists{/gist_id}","starred_url":"https://api.github.com/users/enj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enj/subscriptions","organizations_url":"https://api.github.com/users/enj/orgs","repos_url":"https://api.github.com/users/enj/repos","events_url":"https://api.github.com/users/enj/events{/privacy}","received_events_url":"https://api.github.com/users/enj/received_events","type":"User","site_admin":false},"body":"Each user now has their own bucket / folder where their `OauthClientAuthorizations` are stored: `/openshift.io/oauth/clientauthorizations/<userName>/<clientName>`.  This allows for fast lookup times per user.  Thus there must be enough information in the object's name to determine the user specific etcd key.\r\n\r\n**Backwards compatibility**\r\n\r\nUsers will only be able to see new `OauthClientAuthorizations`.  The old ones will stay in etcd but will no longer be considered valid and thus will need to be recreated.  The cluster admin will be able to clean up the old objects after an upgrade.  This is achieved by changing the naming scheme of new objects.  The old format was `<userName>:<clientName>` and the new format is `<userName>::<clientName>`.  This makes it easy to distinguish where the object would be stored.  Note that the name of the object is only used to determine the user when the cluster admin is doing a lookup.  User lookups use information from the context and enforce UID matching.\r\n\r\n**Examples**\r\n\r\n`oc get oauthclientauthorization` as `system:admin` (note the mix of old and new objects)\r\n\r\n```\r\nNAME                                                  USER NAME    CLIENT NAME                               SCOPES\r\ndeveloper::system:serviceaccount:myproject:jenkins    developer    system:serviceaccount:myproject:jenkins   user:info\r\ndeveloper1::system:serviceaccount:myproject:jenkins   developer1   system:serviceaccount:myproject:jenkins   user:info\r\ndeveloper1:system:serviceaccount:myproject:jenkins    developer1   system:serviceaccount:myproject:jenkins   user:info\r\ndeveloper:system:serviceaccount:myproject:jenkins     developer    system:serviceaccount:myproject:jenkins   user:info\r\n```\r\n\r\n`-o yaml`\r\n\r\n```yaml\r\napiVersion: v1\r\nitems:\r\n- apiVersion: v1\r\n  clientName: system:serviceaccount:myproject:jenkins\r\n  kind: OAuthClientAuthorization\r\n  metadata:\r\n    creationTimestamp: 2016-11-22T16:08:23Z\r\n    name: developer::system:serviceaccount:myproject:jenkins\r\n    resourceVersion: \"636\"\r\n    selfLink: /oapi/v1/oauthclientauthorizations/developer::system:serviceaccount:myproject:jenkins\r\n    uid: e5163dca-b0cd-11e6-b245-507b9dac97ff\r\n  scopes:\r\n  - user:info\r\n  userName: developer\r\n  userUID: cf29b7cb-b0ca-11e6-ac48-507b9dac97ff\r\n- apiVersion: v1\r\n  clientName: system:serviceaccount:myproject:jenkins\r\n  kind: OAuthClientAuthorization\r\n  metadata:\r\n    creationTimestamp: 2016-11-22T16:02:44Z\r\n    name: developer1::system:serviceaccount:myproject:jenkins\r\n    resourceVersion: \"599\"\r\n    selfLink: /oapi/v1/oauthclientauthorizations/developer1::system:serviceaccount:myproject:jenkins\r\n    uid: 1afc194d-b0cd-11e6-b245-507b9dac97ff\r\n  scopes:\r\n  - user:info\r\n  userName: developer1\r\n  userUID: fe3f3a4e-b0ca-11e6-ac48-507b9dac97ff\r\n- apiVersion: v1\r\n  clientName: system:serviceaccount:myproject:jenkins\r\n  kind: OAuthClientAuthorization\r\n  metadata:\r\n    creationTimestamp: 2016-11-22T15:48:39Z\r\n    name: developer1:system:serviceaccount:myproject:jenkins\r\n    resourceVersion: \"508\"\r\n    selfLink: /oapi/v1/oauthclientauthorizations/developer1:system:serviceaccount:myproject:jenkins\r\n    uid: 235cbdff-b0cb-11e6-ac48-507b9dac97ff\r\n  scopes:\r\n  - user:info\r\n  userName: developer1\r\n  userUID: fe3f3a4e-b0ca-11e6-ac48-507b9dac97ff\r\n- apiVersion: v1\r\n  clientName: system:serviceaccount:myproject:jenkins\r\n  kind: OAuthClientAuthorization\r\n  metadata:\r\n    creationTimestamp: 2016-11-22T15:47:12Z\r\n    name: developer:system:serviceaccount:myproject:jenkins\r\n    resourceVersion: \"494\"\r\n    selfLink: /oapi/v1/oauthclientauthorizations/developer:system:serviceaccount:myproject:jenkins\r\n    uid: ef5c24f2-b0ca-11e6-ac48-507b9dac97ff\r\n  scopes:\r\n  - user:info\r\n  userName: developer\r\n  userUID: cf29b7cb-b0ca-11e6-ac48-507b9dac97ff\r\nkind: List\r\nmetadata: {}\r\n```\r\n\r\n`oc get selfoauthclientauthorization -o yaml` as `developer` or  `developer1` (only new objects visible)\r\n\r\n```\r\nNAME                                      CLIENT NAME                               SCOPES\r\nsystem:serviceaccount:myproject:jenkins   system:serviceaccount:myproject:jenkins   user:info\r\n```\r\n\r\n`oc get selfoauthclientauthorization system:serviceaccount:myproject:jenkins -o yaml` as `developer1` (note the name of object is the clientName)\r\n\r\n```yaml\r\napiVersion: v1\r\nclientName: system:serviceaccount:myproject:jenkins\r\nkind: SelfOAuthClientAuthorization\r\nmetadata:\r\n  creationTimestamp: 2016-11-22T16:02:44Z\r\n  name: system:serviceaccount:myproject:jenkins\r\n  resourceVersion: \"599\"\r\n  selfLink: /oapi/v1/selfoauthclientauthorizations/system:serviceaccount:myproject:jenkins\r\n  uid: 1afc194d-b0cd-11e6-b245-507b9dac97ff\r\nscopes:\r\n- user:info\r\nuserUID: fe3f3a4e-b0ca-11e6-ac48-507b9dac97ff\r\n```\r\n\r\n**Cleanup old objects**\r\n\r\n`oc get oauthclientauthorization -o jsonpath=\"{range .items[*]}{.metadata.name}{\\\"\\\\n\\\"}{end}\" | grep -v '::' | xargs -n 1 echo oc delete oauthclientauthorization` (this could be piped to BASH)\r\n\r\n```\r\noc delete oauthclientauthorization developer1:system:serviceaccount:myproject:jenkins\r\noc delete oauthclientauthorization developer:system:serviceaccount:myproject:jenkins\r\n```\r\n\r\nTrello ref: https://trello.com/c/Tcabgp9F\r\n\r\ncc @openshift/api-review @mfojtik @soltysh @php-coder ","created_at":"2016-11-15T00:32:33Z","updated_at":"2016-12-01T13:26:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3df9758960d3d1d9f9644921bf9ce6bfd59eba2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/11909/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/11909/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/11909/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/0e62f32711f33abce8a5bf28d1b1cdf45c9a4bec","head":{"label":"enj:enj/f/scope_token_crud","ref":"enj/f/scope_token_crud","sha":"0e62f32711f33abce8a5bf28d1b1cdf45c9a4bec","user":{"login":"enj","id":7001223,"avatar_url":"https://avatars.githubusercontent.com/u/7001223?v=3","gravatar_id":"","url":"https://api.github.com/users/enj","html_url":"https://github.com/enj","followers_url":"https://api.github.com/users/enj/followers","following_url":"https://api.github.com/users/enj/following{/other_user}","gists_url":"https://api.github.com/users/enj/gists{/gist_id}","starred_url":"https://api.github.com/users/enj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enj/subscriptions","organizations_url":"https://api.github.com/users/enj/orgs","repos_url":"https://api.github.com/users/enj/repos","events_url":"https://api.github.com/users/enj/events{/privacy}","received_events_url":"https://api.github.com/users/enj/received_events","type":"User","site_admin":false},"repo":{"id":60805236,"name":"origin","full_name":"enj/origin","owner":{"login":"enj","id":7001223,"avatar_url":"https://avatars.githubusercontent.com/u/7001223?v=3","gravatar_id":"","url":"https://api.github.com/users/enj","html_url":"https://github.com/enj","followers_url":"https://api.github.com/users/enj/followers","following_url":"https://api.github.com/users/enj/following{/other_user}","gists_url":"https://api.github.com/users/enj/gists{/gist_id}","starred_url":"https://api.github.com/users/enj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enj/subscriptions","organizations_url":"https://api.github.com/users/enj/orgs","repos_url":"https://api.github.com/users/enj/repos","events_url":"https://api.github.com/users/enj/events{/privacy}","received_events_url":"https://api.github.com/users/enj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/enj/origin","description":"OpenShift - Build, deploy, and manage cloud-native and legacy applications with Kubernetes and Docker","fork":true,"url":"https://api.github.com/repos/enj/origin","forks_url":"https://api.github.com/repos/enj/origin/forks","keys_url":"https://api.github.com/repos/enj/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enj/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enj/origin/teams","hooks_url":"https://api.github.com/repos/enj/origin/hooks","issue_events_url":"https://api.github.com/repos/enj/origin/issues/events{/number}","events_url":"https://api.github.com/repos/enj/origin/events","assignees_url":"https://api.github.com/repos/enj/origin/assignees{/user}","branches_url":"https://api.github.com/repos/enj/origin/branches{/branch}","tags_url":"https://api.github.com/repos/enj/origin/tags","blobs_url":"https://api.github.com/repos/enj/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enj/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enj/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/enj/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enj/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/enj/origin/languages","stargazers_url":"https://api.github.com/repos/enj/origin/stargazers","contributors_url":"https://api.github.com/repos/enj/origin/contributors","subscribers_url":"https://api.github.com/repos/enj/origin/subscribers","subscription_url":"https://api.github.com/repos/enj/origin/subscription","commits_url":"https://api.github.com/repos/enj/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/enj/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/enj/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/enj/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/enj/origin/contents/{+path}","compare_url":"https://api.github.com/repos/enj/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enj/origin/merges","archive_url":"https://api.github.com/repos/enj/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enj/origin/downloads","issues_url":"https://api.github.com/repos/enj/origin/issues{/number}","pulls_url":"https://api.github.com/repos/enj/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/enj/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/enj/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enj/origin/labels{/name}","releases_url":"https://api.github.com/repos/enj/origin/releases{/id}","deployments_url":"https://api.github.com/repos/enj/origin/deployments","created_at":"2016-06-09T20:34:28Z","updated_at":"2016-06-09T20:34:35Z","pushed_at":"2016-11-29T22:38:47Z","git_url":"git://github.com/enj/origin.git","ssh_url":"git@github.com:enj/origin.git","clone_url":"https://github.com/enj/origin.git","svn_url":"https://github.com/enj/origin","homepage":"http://www.openshift.org","size":395366,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"openshift:master","ref":"master","sha":"3b2bbe5eb8e703570bbd40a330672ba7c9b88d7f","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"Enterprise Kubernetes for Developers","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin/deployments","created_at":"2014-07-30T20:04:05Z","updated_at":"2016-12-01T10:22:37Z","pushed_at":"2016-12-01T13:18:49Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":643076,"stargazers_count":2086,"watchers_count":2086,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1387,"mirror_url":null,"open_issues_count":1170,"forks":1387,"open_issues":1170,"watchers":2086,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/11909"},"html":{"href":"https://github.com/openshift/origin/pull/11909"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/11909"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/11909/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/11909/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/11909/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/0e62f32711f33abce8a5bf28d1b1cdf45c9a4bec"}}}}
{"actor":{"display_login":"soltysh"}}