{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/94986931","pull_request_review_id":15532197,"id":94986931,"diff_hunk":"@@ -0,0 +1,147 @@\n+/*\n+Copyright 2017 The Kubernetes Authors.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package admission\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\n+\t\"github.com/ghodss/yaml\"\n+\t\"github.com/golang/glog\"\n+\n+\t\"bytes\"\n+\n+\t\"k8s.io/kubernetes/pkg/api\"\n+\t\"k8s.io/kubernetes/pkg/apis/componentconfig\"\n+\tcomponentconfigv1alpha1 \"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1\"\n+\t\"k8s.io/kubernetes/pkg/runtime\"\n+\t\"k8s.io/kubernetes/pkg/util/sets\"\n+)\n+\n+// ReadAdmissionConfiguration reads the admission configuration at the specified path.\n+// It returns the loaded admission configuration if the input file aligns with the required syntax.\n+// If it does not align with the provided syntax, it returns a default configuration for the enumerated\n+// set of pluginNames whose config location references the specified configFilePath.\n+// It does this to preserve backward compatibility when admission control files were opaque.\n+// It returns an error if the file did not exist.\n+func ReadAdmissionConfiguration(pluginNames []string, configFilePath string) (*componentconfig.AdmissionConfiguration, error) {","path":"pkg/admission/config.go","position":42,"original_position":42,"commit_id":"b49bbe87c16e7d7f6306d8caa83b9fd13bf67aff","original_commit_id":"b49bbe87c16e7d7f6306d8caa83b9fd13bf67aff","user":{"login":"derekwaynecarr","id":6233452,"avatar_url":"https://avatars.githubusercontent.com/u/6233452?v=3","gravatar_id":"","url":"https://api.github.com/users/derekwaynecarr","html_url":"https://github.com/derekwaynecarr","followers_url":"https://api.github.com/users/derekwaynecarr/followers","following_url":"https://api.github.com/users/derekwaynecarr/following{/other_user}","gists_url":"https://api.github.com/users/derekwaynecarr/gists{/gist_id}","starred_url":"https://api.github.com/users/derekwaynecarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekwaynecarr/subscriptions","organizations_url":"https://api.github.com/users/derekwaynecarr/orgs","repos_url":"https://api.github.com/users/derekwaynecarr/repos","events_url":"https://api.github.com/users/derekwaynecarr/events{/privacy}","received_events_url":"https://api.github.com/users/derekwaynecarr/received_events","type":"User","site_admin":false},"body":"agreed, will write one up.","created_at":"2017-01-06T17:45:07Z","updated_at":"2017-01-06T17:45:07Z","html_url":"https://github.com/kubernetes/kubernetes/pull/39109#discussion_r94986931","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/94986931"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/39109#discussion_r94986931"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109","id":99025383,"html_url":"https://github.com/kubernetes/kubernetes/pull/39109","diff_url":"https://github.com/kubernetes/kubernetes/pull/39109.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/39109.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39109","number":39109,"state":"open","locked":false,"title":"Admission control support for versioned configuration files","user":{"login":"derekwaynecarr","id":6233452,"avatar_url":"https://avatars.githubusercontent.com/u/6233452?v=3","gravatar_id":"","url":"https://api.github.com/users/derekwaynecarr","html_url":"https://github.com/derekwaynecarr","followers_url":"https://api.github.com/users/derekwaynecarr/followers","following_url":"https://api.github.com/users/derekwaynecarr/following{/other_user}","gists_url":"https://api.github.com/users/derekwaynecarr/gists{/gist_id}","starred_url":"https://api.github.com/users/derekwaynecarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekwaynecarr/subscriptions","organizations_url":"https://api.github.com/users/derekwaynecarr/orgs","repos_url":"https://api.github.com/users/derekwaynecarr/repos","events_url":"https://api.github.com/users/derekwaynecarr/events{/privacy}","received_events_url":"https://api.github.com/users/derekwaynecarr/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it**:\r\nToday, the `--admission-control-config-file=` argument takes an opaque file that is shared across all admission controllers to provide configuration.  This file is not well-versioned and it's shared across multiple plug-ins.  Some plugins take file based configuration (`ImagePolicyWebhook`) and others abuse flags to provide configuration because we lacked a good example (`InitialResources`).  This PR defines a versioned configuration format that we can use moving forward to provide configuration input to admission controllers that is well-versioned, and does not require the addition of new flags.\r\n\r\nThe sample configuration file would look as follows:\r\n\r\n```\r\napiVersion: componentconfig/v1alpha1\r\nkind: AdmissionConfiguration\r\nplugins:\r\n- name: \"ImagePolicyWebhook\"\r\n  location: \"image-policy-webhook.json\"\r\n```\r\n\r\nThe general behavior is each plugin that requires additional configuration is enumerated by name.  An alternate file location is provided for its specific configuration, or the configuration can be embedded as a raw extension via the configuration section.\r\n\r\n**Special notes for your reviewer**:\r\nA follow-on PR will be needed to make `ImagePolicyWebhook` to use versioned configuration.  This PR maintains backwards compatibility by ignoring configuration it cannot understand and therefore treating the file as opaque.  I plan to make use of this PR to complete https://github.com/kubernetes/kubernetes/pull/36765 which attempts to allow more configuration parameters to the `ResourceQuota` admission plugin.","created_at":"2016-12-21T23:46:45Z","updated_at":"2017-01-06T17:45:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c9de043548eb3716e5db4308b028156a22bae51","assignee":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"assignees":[{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39109/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/b49bbe87c16e7d7f6306d8caa83b9fd13bf67aff","head":{"label":"derekwaynecarr:admission-version-config","ref":"admission-version-config","sha":"b49bbe87c16e7d7f6306d8caa83b9fd13bf67aff","user":{"login":"derekwaynecarr","id":6233452,"avatar_url":"https://avatars.githubusercontent.com/u/6233452?v=3","gravatar_id":"","url":"https://api.github.com/users/derekwaynecarr","html_url":"https://github.com/derekwaynecarr","followers_url":"https://api.github.com/users/derekwaynecarr/followers","following_url":"https://api.github.com/users/derekwaynecarr/following{/other_user}","gists_url":"https://api.github.com/users/derekwaynecarr/gists{/gist_id}","starred_url":"https://api.github.com/users/derekwaynecarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekwaynecarr/subscriptions","organizations_url":"https://api.github.com/users/derekwaynecarr/orgs","repos_url":"https://api.github.com/users/derekwaynecarr/repos","events_url":"https://api.github.com/users/derekwaynecarr/events{/privacy}","received_events_url":"https://api.github.com/users/derekwaynecarr/received_events","type":"User","site_admin":false},"repo":{"id":21397341,"name":"kubernetes","full_name":"derekwaynecarr/kubernetes","owner":{"login":"derekwaynecarr","id":6233452,"avatar_url":"https://avatars.githubusercontent.com/u/6233452?v=3","gravatar_id":"","url":"https://api.github.com/users/derekwaynecarr","html_url":"https://github.com/derekwaynecarr","followers_url":"https://api.github.com/users/derekwaynecarr/followers","following_url":"https://api.github.com/users/derekwaynecarr/following{/other_user}","gists_url":"https://api.github.com/users/derekwaynecarr/gists{/gist_id}","starred_url":"https://api.github.com/users/derekwaynecarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekwaynecarr/subscriptions","organizations_url":"https://api.github.com/users/derekwaynecarr/orgs","repos_url":"https://api.github.com/users/derekwaynecarr/repos","events_url":"https://api.github.com/users/derekwaynecarr/events{/privacy}","received_events_url":"https://api.github.com/users/derekwaynecarr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derekwaynecarr/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/derekwaynecarr/kubernetes","forks_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/forks","keys_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/teams","hooks_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/events","assignees_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/tags","blobs_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/languages","stargazers_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/subscription","commits_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/merges","archive_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/downloads","issues_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/derekwaynecarr/kubernetes/deployments","created_at":"2014-07-01T17:56:58Z","updated_at":"2016-03-10T15:33:44Z","pushed_at":"2017-01-06T16:57:32Z","git_url":"git://github.com/derekwaynecarr/kubernetes.git","ssh_url":"git@github.com:derekwaynecarr/kubernetes.git","clone_url":"https://github.com/derekwaynecarr/kubernetes.git","svn_url":"https://github.com/derekwaynecarr/kubernetes","homepage":null,"size":372451,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"9ce93ed50a7822d0fecd167211942cc18e6d965a","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-01-06T17:25:58Z","pushed_at":"2017-01-06T17:35:10Z","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":486323,"stargazers_count":19720,"watchers_count":19720,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6623,"mirror_url":null,"open_issues_count":5446,"forks":6623,"open_issues":5446,"watchers":19720,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/39109"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/39109"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/39109/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/39109/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/b49bbe87c16e7d7f6306d8caa83b9fd13bf67aff"}}}}
{"actor":{"display_login":"derekwaynecarr"}}