{"action":"created","comment":{"url":"https://api.github.com/repos/kiali/kiali/pulls/comments/199187521","pull_request_review_id":133261754,"id":199187521,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTE4NzUyMQ==","diff_hunk":"@@ -0,0 +1,97 @@\n+package virtual_services\n+\n+import (\n+\t\"reflect\"\n+\t\"strconv\"\n+\n+\t\"github.com/kiali/kiali/kubernetes\"\n+\t\"github.com/kiali/kiali/services/models\"\n+\t\"github.com/kiali/kiali/util/intutil\"\n+)\n+\n+type RouteChecker struct{ kubernetes.IstioObject }\n+\n+// Check returns both an array of IstioCheck and a boolean indicating if the current route rule is valid.\n+// The array of IstioChecks contains the result of running the following validations:\n+// 1. All weights with a numeric number.\n+// 2. All weights have value between 0 and 100.\n+// 3. Sum of all weights are 100 (if only one weight, then it assumes that is 100).\n+// 4. All the route has to have weight label.\n+func (route RouteChecker) Check() ([]*models.IstioCheck, bool) {\n+\tchecks, valid := route.checkRoutesFor(\"http\")\n+\ttcpChecks, tcpValid := route.checkRoutesFor(\"tcp\")\n+\treturn append(checks, tcpChecks...), valid && tcpValid\n+}\n+\n+func (route RouteChecker) checkRoutesFor(kind string) ([]*models.IstioCheck, bool) {\n+\tvalidations := make([]*models.IstioCheck, 0)\n+\n+\tvar weightSum int\n+\tvar weightCount int\n+\tvar valid = true\n+\n+\thttp := route.GetSpec()[kind]\n+\tif http == nil {\n+\t\treturn validations, valid\n+\t}\n+\n+\t// Getting a []HTTPRoute\n+\tslice := reflect.ValueOf(http)","path":"services/business/checkers/virtual_services/route_checker.go","position":39,"original_position":39,"commit_id":"16f44ef93b29da96c6bee76532258110da1c6e32","original_commit_id":"16f44ef93b29da96c6bee76532258110da1c6e32","user":{"login":"jotak","id":2153442,"node_id":"MDQ6VXNlcjIxNTM0NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/2153442?v=4","gravatar_id":"","url":"https://api.github.com/users/jotak","html_url":"https://github.com/jotak","followers_url":"https://api.github.com/users/jotak/followers","following_url":"https://api.github.com/users/jotak/following{/other_user}","gists_url":"https://api.github.com/users/jotak/gists{/gist_id}","starred_url":"https://api.github.com/users/jotak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jotak/subscriptions","organizations_url":"https://api.github.com/users/jotak/orgs","repos_url":"https://api.github.com/users/jotak/repos","events_url":"https://api.github.com/users/jotak/events{/privacy}","received_events_url":"https://api.github.com/users/jotak/received_events","type":"User","site_admin":false},"body":"I guess all of these reflections are somehow due to the lack of generics in go? That makes me feel uncomfortable, but maybe there's no other simple way.","created_at":"2018-06-29T14:59:31Z","updated_at":"2018-06-29T14:59:31Z","html_url":"https://github.com/kiali/kiali/pull/319#discussion_r199187521","pull_request_url":"https://api.github.com/repos/kiali/kiali/pulls/319","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kiali/kiali/pulls/comments/199187521"},"html":{"href":"https://github.com/kiali/kiali/pull/319#discussion_r199187521"},"pull_request":{"href":"https://api.github.com/repos/kiali/kiali/pulls/319"}}},"pull_request":{"url":"https://api.github.com/repos/kiali/kiali/pulls/319","id":197382922,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3MzgyOTIy","html_url":"https://github.com/kiali/kiali/pull/319","diff_url":"https://github.com/kiali/kiali/pull/319.diff","patch_url":"https://github.com/kiali/kiali/pull/319.patch","issue_url":"https://api.github.com/repos/kiali/kiali/issues/319","number":319,"state":"open","locked":false,"title":"KIALI-1014 Move route validations to Virtual Services","user":{"login":"xeviknal","id":613814,"node_id":"MDQ6VXNlcjYxMzgxNA==","avatar_url":"https://avatars2.githubusercontent.com/u/613814?v=4","gravatar_id":"","url":"https://api.github.com/users/xeviknal","html_url":"https://github.com/xeviknal","followers_url":"https://api.github.com/users/xeviknal/followers","following_url":"https://api.github.com/users/xeviknal/following{/other_user}","gists_url":"https://api.github.com/users/xeviknal/gists{/gist_id}","starred_url":"https://api.github.com/users/xeviknal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xeviknal/subscriptions","organizations_url":"https://api.github.com/users/xeviknal/orgs","repos_url":"https://api.github.com/users/xeviknal/repos","events_url":"https://api.github.com/users/xeviknal/events{/privacy}","received_events_url":"https://api.github.com/users/xeviknal/received_events","type":"User","site_admin":false},"body":"![virtual-service-validations](https://user-images.githubusercontent.com/613814/41907304-bd649da6-7940-11e8-87e5-03d3d1300a6f.png)\r\n\r\nShortcut to JIRA: https://issues.jboss.org/browse/KIALI-1014\r\n","created_at":"2018-06-26T11:00:20Z","updated_at":"2018-06-29T14:59:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac608da2b63ada03aecb8469d3de8b5680ba30e9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kiali/kiali/pulls/319/commits","review_comments_url":"https://api.github.com/repos/kiali/kiali/pulls/319/comments","review_comment_url":"https://api.github.com/repos/kiali/kiali/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kiali/kiali/issues/319/comments","statuses_url":"https://api.github.com/repos/kiali/kiali/statuses/16f44ef93b29da96c6bee76532258110da1c6e32","head":{"label":"xeviknal:KIALI-1014","ref":"KIALI-1014","sha":"16f44ef93b29da96c6bee76532258110da1c6e32","user":{"login":"xeviknal","id":613814,"node_id":"MDQ6VXNlcjYxMzgxNA==","avatar_url":"https://avatars2.githubusercontent.com/u/613814?v=4","gravatar_id":"","url":"https://api.github.com/users/xeviknal","html_url":"https://github.com/xeviknal","followers_url":"https://api.github.com/users/xeviknal/followers","following_url":"https://api.github.com/users/xeviknal/following{/other_user}","gists_url":"https://api.github.com/users/xeviknal/gists{/gist_id}","starred_url":"https://api.github.com/users/xeviknal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xeviknal/subscriptions","organizations_url":"https://api.github.com/users/xeviknal/orgs","repos_url":"https://api.github.com/users/xeviknal/repos","events_url":"https://api.github.com/users/xeviknal/events{/privacy}","received_events_url":"https://api.github.com/users/xeviknal/received_events","type":"User","site_admin":false},"repo":{"id":120455008,"node_id":"MDEwOlJlcG9zaXRvcnkxMjA0NTUwMDg=","name":"swscore","full_name":"xeviknal/swscore","owner":{"login":"xeviknal","id":613814,"node_id":"MDQ6VXNlcjYxMzgxNA==","avatar_url":"https://avatars2.githubusercontent.com/u/613814?v=4","gravatar_id":"","url":"https://api.github.com/users/xeviknal","html_url":"https://github.com/xeviknal","followers_url":"https://api.github.com/users/xeviknal/followers","following_url":"https://api.github.com/users/xeviknal/following{/other_user}","gists_url":"https://api.github.com/users/xeviknal/gists{/gist_id}","starred_url":"https://api.github.com/users/xeviknal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xeviknal/subscriptions","organizations_url":"https://api.github.com/users/xeviknal/orgs","repos_url":"https://api.github.com/users/xeviknal/repos","events_url":"https://api.github.com/users/xeviknal/events{/privacy}","received_events_url":"https://api.github.com/users/xeviknal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xeviknal/swscore","description":null,"fork":true,"url":"https://api.github.com/repos/xeviknal/swscore","forks_url":"https://api.github.com/repos/xeviknal/swscore/forks","keys_url":"https://api.github.com/repos/xeviknal/swscore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xeviknal/swscore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xeviknal/swscore/teams","hooks_url":"https://api.github.com/repos/xeviknal/swscore/hooks","issue_events_url":"https://api.github.com/repos/xeviknal/swscore/issues/events{/number}","events_url":"https://api.github.com/repos/xeviknal/swscore/events","assignees_url":"https://api.github.com/repos/xeviknal/swscore/assignees{/user}","branches_url":"https://api.github.com/repos/xeviknal/swscore/branches{/branch}","tags_url":"https://api.github.com/repos/xeviknal/swscore/tags","blobs_url":"https://api.github.com/repos/xeviknal/swscore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xeviknal/swscore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xeviknal/swscore/git/refs{/sha}","trees_url":"https://api.github.com/repos/xeviknal/swscore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xeviknal/swscore/statuses/{sha}","languages_url":"https://api.github.com/repos/xeviknal/swscore/languages","stargazers_url":"https://api.github.com/repos/xeviknal/swscore/stargazers","contributors_url":"https://api.github.com/repos/xeviknal/swscore/contributors","subscribers_url":"https://api.github.com/repos/xeviknal/swscore/subscribers","subscription_url":"https://api.github.com/repos/xeviknal/swscore/subscription","commits_url":"https://api.github.com/repos/xeviknal/swscore/commits{/sha}","git_commits_url":"https://api.github.com/repos/xeviknal/swscore/git/commits{/sha}","comments_url":"https://api.github.com/repos/xeviknal/swscore/comments{/number}","issue_comment_url":"https://api.github.com/repos/xeviknal/swscore/issues/comments{/number}","contents_url":"https://api.github.com/repos/xeviknal/swscore/contents/{+path}","compare_url":"https://api.github.com/repos/xeviknal/swscore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xeviknal/swscore/merges","archive_url":"https://api.github.com/repos/xeviknal/swscore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xeviknal/swscore/downloads","issues_url":"https://api.github.com/repos/xeviknal/swscore/issues{/number}","pulls_url":"https://api.github.com/repos/xeviknal/swscore/pulls{/number}","milestones_url":"https://api.github.com/repos/xeviknal/swscore/milestones{/number}","notifications_url":"https://api.github.com/repos/xeviknal/swscore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xeviknal/swscore/labels{/name}","releases_url":"https://api.github.com/repos/xeviknal/swscore/releases{/id}","deployments_url":"https://api.github.com/repos/xeviknal/swscore/deployments","created_at":"2018-02-06T12:44:52Z","updated_at":"2018-04-05T10:05:23Z","pushed_at":"2018-06-28T16:24:07Z","git_url":"git://github.com/xeviknal/swscore.git","ssh_url":"git@github.com:xeviknal/swscore.git","clone_url":"https://github.com/xeviknal/swscore.git","svn_url":"https://github.com/xeviknal/swscore","homepage":null,"size":11358,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"kiali:master","ref":"master","sha":"59c62ae50e039d2126fe344cd84250c0dd341241","user":{"login":"kiali","id":36001875,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MDAxODc1","avatar_url":"https://avatars2.githubusercontent.com/u/36001875?v=4","gravatar_id":"","url":"https://api.github.com/users/kiali","html_url":"https://github.com/kiali","followers_url":"https://api.github.com/users/kiali/followers","following_url":"https://api.github.com/users/kiali/following{/other_user}","gists_url":"https://api.github.com/users/kiali/gists{/gist_id}","starred_url":"https://api.github.com/users/kiali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiali/subscriptions","organizations_url":"https://api.github.com/users/kiali/orgs","repos_url":"https://api.github.com/users/kiali/repos","events_url":"https://api.github.com/users/kiali/events{/privacy}","received_events_url":"https://api.github.com/users/kiali/received_events","type":"Organization","site_admin":false},"repo":{"id":120181748,"node_id":"MDEwOlJlcG9zaXRvcnkxMjAxODE3NDg=","name":"kiali","full_name":"kiali/kiali","owner":{"login":"kiali","id":36001875,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MDAxODc1","avatar_url":"https://avatars2.githubusercontent.com/u/36001875?v=4","gravatar_id":"","url":"https://api.github.com/users/kiali","html_url":"https://github.com/kiali","followers_url":"https://api.github.com/users/kiali/followers","following_url":"https://api.github.com/users/kiali/following{/other_user}","gists_url":"https://api.github.com/users/kiali/gists{/gist_id}","starred_url":"https://api.github.com/users/kiali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiali/subscriptions","organizations_url":"https://api.github.com/users/kiali/orgs","repos_url":"https://api.github.com/users/kiali/repos","events_url":"https://api.github.com/users/kiali/events{/privacy}","received_events_url":"https://api.github.com/users/kiali/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kiali/kiali","description":"Kiali project, observability for the Istio service mesh","fork":false,"url":"https://api.github.com/repos/kiali/kiali","forks_url":"https://api.github.com/repos/kiali/kiali/forks","keys_url":"https://api.github.com/repos/kiali/kiali/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kiali/kiali/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kiali/kiali/teams","hooks_url":"https://api.github.com/repos/kiali/kiali/hooks","issue_events_url":"https://api.github.com/repos/kiali/kiali/issues/events{/number}","events_url":"https://api.github.com/repos/kiali/kiali/events","assignees_url":"https://api.github.com/repos/kiali/kiali/assignees{/user}","branches_url":"https://api.github.com/repos/kiali/kiali/branches{/branch}","tags_url":"https://api.github.com/repos/kiali/kiali/tags","blobs_url":"https://api.github.com/repos/kiali/kiali/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kiali/kiali/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kiali/kiali/git/refs{/sha}","trees_url":"https://api.github.com/repos/kiali/kiali/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kiali/kiali/statuses/{sha}","languages_url":"https://api.github.com/repos/kiali/kiali/languages","stargazers_url":"https://api.github.com/repos/kiali/kiali/stargazers","contributors_url":"https://api.github.com/repos/kiali/kiali/contributors","subscribers_url":"https://api.github.com/repos/kiali/kiali/subscribers","subscription_url":"https://api.github.com/repos/kiali/kiali/subscription","commits_url":"https://api.github.com/repos/kiali/kiali/commits{/sha}","git_commits_url":"https://api.github.com/repos/kiali/kiali/git/commits{/sha}","comments_url":"https://api.github.com/repos/kiali/kiali/comments{/number}","issue_comment_url":"https://api.github.com/repos/kiali/kiali/issues/comments{/number}","contents_url":"https://api.github.com/repos/kiali/kiali/contents/{+path}","compare_url":"https://api.github.com/repos/kiali/kiali/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kiali/kiali/merges","archive_url":"https://api.github.com/repos/kiali/kiali/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kiali/kiali/downloads","issues_url":"https://api.github.com/repos/kiali/kiali/issues{/number}","pulls_url":"https://api.github.com/repos/kiali/kiali/pulls{/number}","milestones_url":"https://api.github.com/repos/kiali/kiali/milestones{/number}","notifications_url":"https://api.github.com/repos/kiali/kiali/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kiali/kiali/labels{/name}","releases_url":"https://api.github.com/repos/kiali/kiali/releases{/id}","deployments_url":"https://api.github.com/repos/kiali/kiali/deployments","created_at":"2018-02-04T12:11:57Z","updated_at":"2018-06-27T17:48:47Z","pushed_at":"2018-06-28T16:24:09Z","git_url":"git://github.com/kiali/kiali.git","ssh_url":"git@github.com:kiali/kiali.git","clone_url":"https://github.com/kiali/kiali.git","svn_url":"https://github.com/kiali/kiali","homepage":"https://kiali.org/","size":11383,"stargazers_count":105,"watchers_count":105,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":29,"mirror_url":null,"archived":false,"open_issues_count":18,"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":29,"open_issues":18,"watchers":105,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kiali/kiali/pulls/319"},"html":{"href":"https://github.com/kiali/kiali/pull/319"},"issue":{"href":"https://api.github.com/repos/kiali/kiali/issues/319"},"comments":{"href":"https://api.github.com/repos/kiali/kiali/issues/319/comments"},"review_comments":{"href":"https://api.github.com/repos/kiali/kiali/pulls/319/comments"},"review_comment":{"href":"https://api.github.com/repos/kiali/kiali/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kiali/kiali/pulls/319/commits"},"statuses":{"href":"https://api.github.com/repos/kiali/kiali/statuses/16f44ef93b29da96c6bee76532258110da1c6e32"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jotak"}}