{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/65346520","id":65346520,"diff_hunk":"@@ -0,0 +1,139 @@\n+package restoptions\n+\n+import (\n+\t\"fmt\"\n+\t\"strconv\"\n+\t\"strings\"\n+\t\"sync\"\n+\n+\tapiserveroptions \"k8s.io/kubernetes/cmd/kube-apiserver/app/options\"\n+\tkapi \"k8s.io/kubernetes/pkg/api\"\n+\t\"k8s.io/kubernetes/pkg/api/rest\"\n+\t\"k8s.io/kubernetes/pkg/api/unversioned\"\n+\tgenericrest \"k8s.io/kubernetes/pkg/registry/generic\"\n+\tgenericetcd \"k8s.io/kubernetes/pkg/registry/generic/etcd\"\n+\t\"k8s.io/kubernetes/pkg/runtime\"\n+\t\"k8s.io/kubernetes/pkg/storage\"\n+\tetcdstorage \"k8s.io/kubernetes/pkg/storage/etcd\"\n+\tkerrors \"k8s.io/kubernetes/pkg/util/errors\"\n+\n+\t\"github.com/golang/glog\"\n+\tconfigapi \"github.com/openshift/origin/pkg/cmd/server/api\"\n+\t\"github.com/openshift/origin/pkg/cmd/server/etcd\"\n+\tcmdflags \"github.com/openshift/origin/pkg/cmd/util/flags\"\n+)\n+\n+// UseDefaultCacheSize indicates that the default configured cache size should be used\n+const UseDefaultCacheSize = 0\n+\n+// configRESTOptionsGetter provides RESTOptions based on a provided config\n+type configRESTOptionsGetter struct {\n+\tmasterOptions configapi.MasterConfig\n+\n+\trestOptionsLock sync.Mutex\n+\trestOptionsMap  map[unversioned.GroupResource]genericrest.RESTOptions\n+\n+\tetcdHelper storage.Interface\n+\n+\tcacheEnabled     bool\n+\tdefaultCacheSize int\n+\tcacheSizes       map[unversioned.GroupResource]int\n+}\n+\n+// NewConfigGetter returns a restoptions.Getter implemented using information from the provided master config.\n+// By default, the etcd watch cache is enabled with a size of 1000 per resource type.\n+func NewConfigGetter(masterOptions configapi.MasterConfig) Getter {\n+\tgetter := &configRESTOptionsGetter{\n+\t\tmasterOptions:    masterOptions,\n+\t\tcacheEnabled:     true,\n+\t\tdefaultCacheSize: 1000,\n+\t\tcacheSizes:       map[unversioned.GroupResource]int{},\n+\t\trestOptionsMap:   map[unversioned.GroupResource]genericrest.RESTOptions{},\n+\t}\n+\n+\tif err := getter.loadWatchCacheSettings(); err != nil {\n+\t\tglog.Error(err)\n+\t}\n+\n+\treturn getter\n+}\n+\n+func (g *configRESTOptionsGetter) loadWatchCacheSettings() error {\n+\tif g.masterOptions.KubernetesMasterConfig == nil {\n+\t\treturn nil\n+\t}\n+\n+\tserver := apiserveroptions.NewAPIServer()\n+\tif errs := cmdflags.Resolve(g.masterOptions.KubernetesMasterConfig.APIServerArguments, server.AddFlags); len(errs) > 0 {\n+\t\treturn kerrors.NewAggregate(errs)\n+\t}\n+\n+\tg.cacheEnabled = server.EnableWatchCache\n+\n+\terrs := []error{}\n+\tfor _, c := range server.WatchCacheSizes {\n+\t\ttokens := strings.Split(c, \"#\")\n+\t\tif len(tokens) != 2 {\n+\t\t\terrs = append(errs, fmt.Errorf(\"invalid watch cache size value '%s', expecting <resource>#<size> format (e.g. builds#100)\", c))","path":"pkg/util/restoptions/configgetter.go","position":77,"original_position":77,"commit_id":"c94f4fcfb7f8484be8f6573f550f4a7333742129","original_commit_id":"c94f4fcfb7f8484be8f6573f550f4a7333742129","user":{"login":"deads2k","id":8225098,"avatar_url":"https://avatars.githubusercontent.com/u/8225098?v=3","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},"body":"Yuck.  I'm assuming this isn't us?","created_at":"2016-06-01T11:58:09Z","updated_at":"2016-06-01T11:58:09Z","html_url":"https://github.com/openshift/origin/pull/9057#discussion_r65346520","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/9057","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/65346520"},"html":{"href":"https://github.com/openshift/origin/pull/9057#discussion_r65346520"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/9057"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/9057","id":71716323,"html_url":"https://github.com/openshift/origin/pull/9057","diff_url":"https://github.com/openshift/origin/pull/9057.diff","patch_url":"https://github.com/openshift/origin/pull/9057.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/9057","number":9057,"state":"open","locked":false,"title":"etcd watch cache for origin types","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":null,"created_at":"2016-05-27T13:52:57Z","updated_at":"2016-06-01T11:58:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51b129a39533a794c5e28280fc751e4babc1c6bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/9057/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/9057/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/9057/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/c94f4fcfb7f8484be8f6573f550f4a7333742129","head":{"label":"liggitt:etcd-watch-cache","ref":"etcd-watch-cache","sha":"c94f4fcfb7f8484be8f6573f550f4a7333742129","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},"repo":{"id":23198153,"name":"origin","full_name":"liggitt/origin","owner":{"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},"private":false,"html_url":"https://github.com/liggitt/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/liggitt/origin","forks_url":"https://api.github.com/repos/liggitt/origin/forks","keys_url":"https://api.github.com/repos/liggitt/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/liggitt/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/liggitt/origin/teams","hooks_url":"https://api.github.com/repos/liggitt/origin/hooks","issue_events_url":"https://api.github.com/repos/liggitt/origin/issues/events{/number}","events_url":"https://api.github.com/repos/liggitt/origin/events","assignees_url":"https://api.github.com/repos/liggitt/origin/assignees{/user}","branches_url":"https://api.github.com/repos/liggitt/origin/branches{/branch}","tags_url":"https://api.github.com/repos/liggitt/origin/tags","blobs_url":"https://api.github.com/repos/liggitt/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/liggitt/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/liggitt/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/liggitt/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/liggitt/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/liggitt/origin/languages","stargazers_url":"https://api.github.com/repos/liggitt/origin/stargazers","contributors_url":"https://api.github.com/repos/liggitt/origin/contributors","subscribers_url":"https://api.github.com/repos/liggitt/origin/subscribers","subscription_url":"https://api.github.com/repos/liggitt/origin/subscription","commits_url":"https://api.github.com/repos/liggitt/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/liggitt/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/liggitt/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/liggitt/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/liggitt/origin/contents/{+path}","compare_url":"https://api.github.com/repos/liggitt/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/liggitt/origin/merges","archive_url":"https://api.github.com/repos/liggitt/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/liggitt/origin/downloads","issues_url":"https://api.github.com/repos/liggitt/origin/issues{/number}","pulls_url":"https://api.github.com/repos/liggitt/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/liggitt/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/liggitt/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/liggitt/origin/labels{/name}","releases_url":"https://api.github.com/repos/liggitt/origin/releases{/id}","deployments_url":"https://api.github.com/repos/liggitt/origin/deployments","created_at":"2014-08-21T18:23:05Z","updated_at":"2016-01-11T15:42:07Z","pushed_at":"2016-06-01T04:13:46Z","git_url":"git://github.com/liggitt/origin.git","ssh_url":"git@github.com:liggitt/origin.git","clone_url":"https://github.com/liggitt/origin.git","svn_url":"https://github.com/liggitt/origin","homepage":"https://openshift.github.io","size":285985,"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":"681170a6794859a24dcf35c6694a7718083ad853","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":"OpenShift - Build, deploy, and manage cloud-native and legacy applications with Kubernetes and Docker","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-05-30T01:49:36Z","pushed_at":"2016-06-01T11:15:36Z","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":509625,"stargazers_count":1325,"watchers_count":1325,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":799,"mirror_url":null,"open_issues_count":1034,"forks":799,"open_issues":1034,"watchers":1325,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/9057"},"html":{"href":"https://github.com/openshift/origin/pull/9057"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/9057"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/9057/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/9057/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/9057/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/c94f4fcfb7f8484be8f6573f550f4a7333742129"}}}}
{"actor":{"display_login":"deads2k"}}