{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/53213589","id":53213589,"diff_hunk":"@@ -0,0 +1,77 @@\n+package podnodeconstraints\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"reflect\"\n+\n+\tconfiglatest \"github.com/openshift/origin/pkg/cmd/server/api/latest\"\n+\t\"github.com/openshift/origin/pkg/scheduler/admission/podnodeconstraints/api\"\n+\n+\tadmission \"k8s.io/kubernetes/pkg/admission\"\n+\tkapi \"k8s.io/kubernetes/pkg/api\"\n+\tkclient \"k8s.io/kubernetes/pkg/client/unversioned\"\n+)\n+\n+func init() {\n+\tadmission.RegisterPlugin(\"PodNodeConstraints\", func(c kclient.Interface, config io.Reader) (admission.Interface, error) {\n+\t\tpluginConfig, err := readConfig(config)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t\treturn NewPodNodeConstraints(pluginConfig), nil\n+\t})\n+}\n+\n+func NewPodNodeConstraints(config *api.PodNodeConstraintsConfig) admission.Interface {\n+\treturn &podNodeConstraints{\n+\t\tconfig:  config,\n+\t\tHandler: admission.NewHandler(admission.Create),\n+\t}\n+}\n+\n+type podNodeConstraints struct {\n+\t*admission.Handler\n+\tconfig *api.PodNodeConstraintsConfig\n+}\n+\n+func readConfig(reader io.Reader) (*api.PodNodeConstraintsConfig, error) {\n+\tif reader == nil || reflect.ValueOf(reader).IsNil() {\n+\t\treturn &api.PodNodeConstraintsConfig{}, nil\n+\t}\n+\n+\tconfigBytes, err := ioutil.ReadAll(reader)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tconfig := &api.PodNodeConstraintsConfig{}\n+\terr = configlatest.ReadYAML(configBytes, config)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\t// No validation needed since config is just 2 bools\n+\treturn config, nil\n+}\n+\n+func (oo *podNodeConstraints) Admit(aa admission.Attributes) error {\n+\tswitch {\n+\tcase oo.config == nil,\n+\t\taa.GetResource() != kapi.Resource(\"pods\"),\n+\t\taa.GetKind().Kind != \"Pod\",\n+\t\taa.GetSubresource() != \"\",\n+\t\taa.GetOperation() != admission.Create:\n+\t\treturn nil\n+\t}\n+\tpod, ok := aa.GetObject().(*kapi.Pod)\n+\tif !ok {\n+\t\treturn admission.NewForbidden(aa, fmt.Errorf(\"unexpected object: %#v\", aa.GetObject()))\n+\t}\n+\tif len(pod.Spec.NodeName) > 0 && oo.config.ProhibitNodeName {","path":"pkg/scheduler/admission/podnodeconstraints/admission.go","position":70,"original_position":70,"commit_id":"788127d91c20f09018e4f6cc2123f0218afad6f2","original_commit_id":"2799d52bf934c4f06c5a96233b9f9a924a0ae889","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":"> This is sounding more like pod security the more we talk about it....\r\n\r\nSCC is currently focused on what a particular pod can do, not on where a particular pod can live.  I don't think it makes much sense to combine those concepts in this way.  I could probably see: \"a pod can do this on that node\", but I really don't see SCC as something to control scheduling.","created_at":"2016-02-17T19:05:27Z","updated_at":"2016-02-17T19:05:27Z","html_url":"https://github.com/openshift/origin/pull/6979#discussion_r53213589","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/6979","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/53213589"},"html":{"href":"https://github.com/openshift/origin/pull/6979#discussion_r53213589"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/6979"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/6979","id":58049134,"html_url":"https://github.com/openshift/origin/pull/6979","diff_url":"https://github.com/openshift/origin/pull/6979.diff","patch_url":"https://github.com/openshift/origin/pull/6979.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/6979","number":6979,"state":"open","locked":false,"title":"Add constraints for nodeName and nodeSelector","user":{"login":"dobbymoodge","id":1537044,"avatar_url":"https://avatars.githubusercontent.com/u/1537044?v=3","gravatar_id":"","url":"https://api.github.com/users/dobbymoodge","html_url":"https://github.com/dobbymoodge","followers_url":"https://api.github.com/users/dobbymoodge/followers","following_url":"https://api.github.com/users/dobbymoodge/following{/other_user}","gists_url":"https://api.github.com/users/dobbymoodge/gists{/gist_id}","starred_url":"https://api.github.com/users/dobbymoodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobbymoodge/subscriptions","organizations_url":"https://api.github.com/users/dobbymoodge/orgs","repos_url":"https://api.github.com/users/dobbymoodge/repos","events_url":"https://api.github.com/users/dobbymoodge/events{/privacy}","received_events_url":"https://api.github.com/users/dobbymoodge/received_events","type":"User","site_admin":false},"body":"This adds an admission controller that provides booleans to allow or prohibit the use of `nodeName` and `nodeSelector` fields in pod requests\r\n","created_at":"2016-02-02T21:00:09Z","updated_at":"2016-02-17T19:05:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26c179c3fc5bc58a6a76defdc4ad0caccc4a35fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/6979/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/6979/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/6979/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/788127d91c20f09018e4f6cc2123f0218afad6f2","head":{"label":"dobbymoodge:nodeName_admsnctl","ref":"nodeName_admsnctl","sha":"788127d91c20f09018e4f6cc2123f0218afad6f2","user":{"login":"dobbymoodge","id":1537044,"avatar_url":"https://avatars.githubusercontent.com/u/1537044?v=3","gravatar_id":"","url":"https://api.github.com/users/dobbymoodge","html_url":"https://github.com/dobbymoodge","followers_url":"https://api.github.com/users/dobbymoodge/followers","following_url":"https://api.github.com/users/dobbymoodge/following{/other_user}","gists_url":"https://api.github.com/users/dobbymoodge/gists{/gist_id}","starred_url":"https://api.github.com/users/dobbymoodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobbymoodge/subscriptions","organizations_url":"https://api.github.com/users/dobbymoodge/orgs","repos_url":"https://api.github.com/users/dobbymoodge/repos","events_url":"https://api.github.com/users/dobbymoodge/events{/privacy}","received_events_url":"https://api.github.com/users/dobbymoodge/received_events","type":"User","site_admin":false},"repo":{"id":28879731,"name":"origin","full_name":"dobbymoodge/origin","owner":{"login":"dobbymoodge","id":1537044,"avatar_url":"https://avatars.githubusercontent.com/u/1537044?v=3","gravatar_id":"","url":"https://api.github.com/users/dobbymoodge","html_url":"https://github.com/dobbymoodge","followers_url":"https://api.github.com/users/dobbymoodge/followers","following_url":"https://api.github.com/users/dobbymoodge/following{/other_user}","gists_url":"https://api.github.com/users/dobbymoodge/gists{/gist_id}","starred_url":"https://api.github.com/users/dobbymoodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobbymoodge/subscriptions","organizations_url":"https://api.github.com/users/dobbymoodge/orgs","repos_url":"https://api.github.com/users/dobbymoodge/repos","events_url":"https://api.github.com/users/dobbymoodge/events{/privacy}","received_events_url":"https://api.github.com/users/dobbymoodge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dobbymoodge/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/dobbymoodge/origin","forks_url":"https://api.github.com/repos/dobbymoodge/origin/forks","keys_url":"https://api.github.com/repos/dobbymoodge/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dobbymoodge/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dobbymoodge/origin/teams","hooks_url":"https://api.github.com/repos/dobbymoodge/origin/hooks","issue_events_url":"https://api.github.com/repos/dobbymoodge/origin/issues/events{/number}","events_url":"https://api.github.com/repos/dobbymoodge/origin/events","assignees_url":"https://api.github.com/repos/dobbymoodge/origin/assignees{/user}","branches_url":"https://api.github.com/repos/dobbymoodge/origin/branches{/branch}","tags_url":"https://api.github.com/repos/dobbymoodge/origin/tags","blobs_url":"https://api.github.com/repos/dobbymoodge/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dobbymoodge/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dobbymoodge/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dobbymoodge/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dobbymoodge/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/dobbymoodge/origin/languages","stargazers_url":"https://api.github.com/repos/dobbymoodge/origin/stargazers","contributors_url":"https://api.github.com/repos/dobbymoodge/origin/contributors","subscribers_url":"https://api.github.com/repos/dobbymoodge/origin/subscribers","subscription_url":"https://api.github.com/repos/dobbymoodge/origin/subscription","commits_url":"https://api.github.com/repos/dobbymoodge/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dobbymoodge/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dobbymoodge/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dobbymoodge/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/dobbymoodge/origin/contents/{+path}","compare_url":"https://api.github.com/repos/dobbymoodge/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dobbymoodge/origin/merges","archive_url":"https://api.github.com/repos/dobbymoodge/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dobbymoodge/origin/downloads","issues_url":"https://api.github.com/repos/dobbymoodge/origin/issues{/number}","pulls_url":"https://api.github.com/repos/dobbymoodge/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/dobbymoodge/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/dobbymoodge/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dobbymoodge/origin/labels{/name}","releases_url":"https://api.github.com/repos/dobbymoodge/origin/releases{/id}","deployments_url":"https://api.github.com/repos/dobbymoodge/origin/deployments","created_at":"2015-01-06T19:31:27Z","updated_at":"2016-01-11T20:38:16Z","pushed_at":"2016-02-17T19:02:06Z","git_url":"git://github.com/dobbymoodge/origin.git","ssh_url":"git@github.com:dobbymoodge/origin.git","clone_url":"https://github.com/dobbymoodge/origin.git","svn_url":"https://github.com/dobbymoodge/origin","homepage":"https://openshift.github.io","size":209806,"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":"32a5b10368336dd5ca9bfde18c6ec4b4e194c2c0","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 3 - build, deploy, and manage your applications with Docker and Kubernetes","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-02-17T16:37:18Z","pushed_at":"2016-02-17T19:02:07Z","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":262587,"stargazers_count":1045,"watchers_count":1045,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":636,"mirror_url":null,"open_issues_count":872,"forks":636,"open_issues":872,"watchers":1045,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/6979"},"html":{"href":"https://github.com/openshift/origin/pull/6979"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/6979"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/6979/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/6979/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/6979/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/788127d91c20f09018e4f6cc2123f0218afad6f2"}}}}