{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/comments/195006403","pull_request_review_id":128285493,"id":195006403,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTAwNjQwMw==","diff_hunk":"@@ -0,0 +1,90 @@\n+package operator\n+\n+import (\n+\t\"github.com/golang/glog\"\n+\t\"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n+\t\"k8s.io/apimachinery/pkg/runtime\"\n+\tkyaml \"k8s.io/apimachinery/pkg/util/yaml\"\n+)\n+\n+func mergeProcessConfig(defaultConfigYAML, userConfigYAML []byte, specialCases map[string]mergeFunc) ([]byte, error) {\n+\tdefaultConfigJSON, err := kyaml.ToJSON(defaultConfigYAML)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tdefaultConfigObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, defaultConfigJSON)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tdefaultConfig := defaultConfigObj.(*unstructured.Unstructured)\n+\n+\tif len(userConfigYAML) > 0 {\n+\t\tuserConfigJSON, err := kyaml.ToJSON(userConfigYAML)\n+\t\tif err != nil {\n+\t\t\tglog.Warning(err)\n+\t\t\t// maybe it's just yaml\n+\t\t\tuserConfigJSON = userConfigYAML\n+\t\t}\n+\t\tuserConfigObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, userConfigJSON)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t\tuserConfig := userConfigObj.(*unstructured.Unstructured)\n+\t\tif err := mergeConfig(defaultConfig.Object, userConfig.Object, \"\", specialCases); err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\n+\tconfigBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, defaultConfig)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\treturn configBytes, nil\n+}\n+\n+type mergeFunc func(dst, src interface{}, currentPath string) (interface{}, error)\n+\n+func mergeConfig(curr, additional map[string]interface{}, currentPath string, specialCases map[string]mergeFunc) error {\n+\tfor additionalKey, additionalVal := range additional {\n+\t\tfullKey := currentPath + \".\" + additionalKey\n+\t\tspecialCase, ok := specialCases[fullKey]\n+\t\tif ok {\n+\t\t\tvar err error\n+\t\t\tcurr[additionalKey], err = specialCase(curr[additionalKey], additionalVal, currentPath)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\t\t\tcontinue\n+\t\t}\n+\n+\t\tcurrVal, ok := curr[additionalKey]\n+\t\tif !ok {\n+\t\t\tcurr[additionalKey] = additionalVal\n+\t\t\tcontinue\n+\t\t}\n+\n+\t\t// only some scalars are accepted","path":"pkg/operator/merge.go","position":66,"original_position":66,"commit_id":"e964d79c7e29e6a70edd92a18c03f912b8dafa2b","original_commit_id":"e964d79c7e29e6a70edd92a18c03f912b8dafa2b","user":{"login":"sttts","id":730123,"node_id":"MDQ6VXNlcjczMDEyMw==","avatar_url":"https://avatars0.githubusercontent.com/u/730123?v=4","gravatar_id":"","url":"https://api.github.com/users/sttts","html_url":"https://github.com/sttts","followers_url":"https://api.github.com/users/sttts/followers","following_url":"https://api.github.com/users/sttts/following{/other_user}","gists_url":"https://api.github.com/users/sttts/gists{/gist_id}","starred_url":"https://api.github.com/users/sttts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sttts/subscriptions","organizations_url":"https://api.github.com/users/sttts/orgs","repos_url":"https://api.github.com/users/sttts/repos","events_url":"https://api.github.com/users/sttts/events{/privacy}","received_events_url":"https://api.github.com/users/sttts/received_events","type":"User","site_admin":false},"body":"what do you mean here? Like not supporting int, int32, etc.?","created_at":"2018-06-13T09:04:22Z","updated_at":"2018-06-13T09:04:23Z","html_url":"https://github.com/openshift/service-serving-cert-signer/pull/10#discussion_r195006403","pull_request_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/comments/195006403"},"html":{"href":"https://github.com/openshift/service-serving-cert-signer/pull/10#discussion_r195006403"},"pull_request":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10","id":194386553,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0Mzg2NTUz","html_url":"https://github.com/openshift/service-serving-cert-signer/pull/10","diff_url":"https://github.com/openshift/service-serving-cert-signer/pull/10.diff","patch_url":"https://github.com/openshift/service-serving-cert-signer/pull/10.patch","issue_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues/10","number":10,"state":"open","locked":false,"title":"add simple config merging","user":{"login":"deads2k","id":8225098,"node_id":"MDQ6VXNlcjgyMjUwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","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":"Adds simple config merging based on bare maps with list of special-case functions for particular keys (and their descendants.  I think it's the simplest possible thing that works while preserving the ability to handle things like like our admission config.\r\n\r\n@mfojtik @sttts @liggitt ","created_at":"2018-06-12T19:41:27Z","updated_at":"2018-06-13T09:04:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"294404537ded4d86e15e7b27a1f5fd26db626afc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":930104089,"node_id":"MDU6TGFiZWw5MzAxMDQwODk=","url":"https://api.github.com/repos/openshift/service-serving-cert-signer/labels/size/XXL","name":"size/XXL","color":"ee0000","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10/commits","review_comments_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10/comments","review_comment_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues/10/comments","statuses_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/statuses/e964d79c7e29e6a70edd92a18c03f912b8dafa2b","head":{"label":"deads2k:op-04-merge","ref":"op-04-merge","sha":"e964d79c7e29e6a70edd92a18c03f912b8dafa2b","user":{"login":"deads2k","id":8225098,"node_id":"MDQ6VXNlcjgyMjUwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","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},"repo":{"id":132940905,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI5NDA5MDU=","name":"service-serving-cert-signer","full_name":"deads2k/service-serving-cert-signer","owner":{"login":"deads2k","id":8225098,"node_id":"MDQ6VXNlcjgyMjUwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","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},"private":false,"html_url":"https://github.com/deads2k/service-serving-cert-signer","description":"Controller to mint and manage serving certificates for Kubernetes services","fork":true,"url":"https://api.github.com/repos/deads2k/service-serving-cert-signer","forks_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/forks","keys_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/teams","hooks_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/hooks","issue_events_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/issues/events{/number}","events_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/events","assignees_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/assignees{/user}","branches_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/branches{/branch}","tags_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/tags","blobs_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/git/refs{/sha}","trees_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/statuses/{sha}","languages_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/languages","stargazers_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/stargazers","contributors_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/contributors","subscribers_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/subscribers","subscription_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/subscription","commits_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/commits{/sha}","git_commits_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/git/commits{/sha}","comments_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/comments{/number}","issue_comment_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/issues/comments{/number}","contents_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/contents/{+path}","compare_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/merges","archive_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/downloads","issues_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/issues{/number}","pulls_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/pulls{/number}","milestones_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/milestones{/number}","notifications_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/labels{/name}","releases_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/releases{/id}","deployments_url":"https://api.github.com/repos/deads2k/service-serving-cert-signer/deployments","created_at":"2018-05-10T18:41:41Z","updated_at":"2018-05-31T17:37:35Z","pushed_at":"2018-06-12T19:40:11Z","git_url":"git://github.com/deads2k/service-serving-cert-signer.git","ssh_url":"git@github.com:deads2k/service-serving-cert-signer.git","clone_url":"https://github.com/deads2k/service-serving-cert-signer.git","svn_url":"https://github.com/deads2k/service-serving-cert-signer","homepage":null,"size":14677,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"8afc07017da4cc5bbe30462e2d06c4732f082600","user":{"login":"openshift","id":792337,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MjMzNw==","avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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":132937429,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI5Mzc0Mjk=","name":"service-serving-cert-signer","full_name":"openshift/service-serving-cert-signer","owner":{"login":"openshift","id":792337,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc5MjMzNw==","avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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/service-serving-cert-signer","description":"Controller to mint and manage serving certificates for Kubernetes services","fork":false,"url":"https://api.github.com/repos/openshift/service-serving-cert-signer","forks_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/forks","keys_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/teams","hooks_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/hooks","issue_events_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/events","assignees_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/tags","blobs_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/languages","stargazers_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/stargazers","contributors_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/contributors","subscribers_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/subscribers","subscription_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/subscription","commits_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/merges","archive_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/downloads","issues_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/labels{/name}","releases_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/service-serving-cert-signer/deployments","created_at":"2018-05-10T18:09:28Z","updated_at":"2018-05-31T17:14:30Z","pushed_at":"2018-06-12T19:41:28Z","git_url":"git://github.com/openshift/service-serving-cert-signer.git","ssh_url":"git@github.com:openshift/service-serving-cert-signer.git","clone_url":"https://github.com/openshift/service-serving-cert-signer.git","svn_url":"https://github.com/openshift/service-serving-cert-signer","homepage":null,"size":14545,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":3,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10"},"html":{"href":"https://github.com/openshift/service-serving-cert-signer/pull/10"},"issue":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues/10"},"comments":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/service-serving-cert-signer/statuses/e964d79c7e29e6a70edd92a18c03f912b8dafa2b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sttts"}}