{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/87674591","pull_request_review_id":8281660,"id":87674591,"diff_hunk":"@@ -0,0 +1,410 @@\n+/*\n+Copyright 2016 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 e2e\n+\n+import (\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"net/http\"\n+\t\"strconv\"\n+\t\"strings\"\n+\t\"time\"\n+\n+\t\"k8s.io/kubernetes/pkg/api\"\n+\t\"k8s.io/kubernetes/pkg/api/service\"\n+\t\"k8s.io/kubernetes/pkg/apis/extensions\"\n+\tclientset \"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset\"\n+\t\"k8s.io/kubernetes/pkg/cloudprovider\"\n+\tgcecloud \"k8s.io/kubernetes/pkg/cloudprovider/providers/gce\"\n+\t\"k8s.io/kubernetes/pkg/kubectl\"\n+\t\"k8s.io/kubernetes/pkg/util/sets\"\n+\t\"k8s.io/kubernetes/pkg/util/wait\"\n+\t\"k8s.io/kubernetes/test/e2e/framework\"\n+\n+\t. \"github.com/onsi/ginkgo\"\n+\t. \"github.com/onsi/gomega\"\n+\tcompute \"google.golang.org/api/compute/v1\"\n+)\n+\n+const (\n+\tfirewallTimeoutDefault  = 3 * time.Minute\n+\tfirewallTestHttpTimeout = time.Duration(1 * time.Second)\n+\t// Set ports outside of 30000-32767, 80 and 8080 to avoid being whitelisted by the e2e cluster\n+\tfirewallTestHttpPort = int32(29999)\n+\tfirewallTestUdpPort  = int32(29998)\n+)\n+\n+var _ = framework.KubeDescribe(\"Firewall rule\", func() {\n+\tvar firewall_test_name = \"firewall-test\"\n+\tf := framework.NewDefaultFramework(firewall_test_name)\n+\n+\t// This test takes around 3 minutes to run\n+\tIt(\"[slow] [serial] should create valid firewall rules for LoadBalancer type service\", func() {\n+\t\tframework.SkipUnlessProviderIs(\"gce\")\n+\t\tc := f.ClientSet\n+\t\tns := f.Namespace.Name\n+\t\tcloudConfig := framework.TestContext.CloudConfig\n+\t\tgceCloud := framework.TestContext.CloudConfig.Provider.(*gcecloud.GCECloud)\n+\t\t// This source ranges is just used to examine we have the same things on LB firewall rules\n+\t\tfirewallTestSourceRanges := []string{\"0.0.0.0/1\", \"128.0.0.0/1\"}\n+\n+\t\t// OnlyLocal service is needed to examine which exact nodes the requests are being forward to by the Load Balancer on GCE\n+\t\tBy(\"Creating a LoadBalancer type service with onlyLocal annotation\")\n+\t\tserviceName := \"firewall-test-loadbalancer\"\n+\t\tjig := NewServiceTestJig(c, serviceName)\n+\t\tsvc := createOnlyLocalLoadBalancServiceWithPort(jig, ns, serviceName, firewallTestHttpPort, firewallTestSourceRanges)\n+\t\tdefer func() {","path":"test/e2e/firewall.go","position":70,"original_position":70,"commit_id":"f1a37498a8c8a314594cd08f323e26e85ed34259","original_commit_id":"f1a37498a8c8a314594cd08f323e26e85ed34259","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"body":"you want to change the type to !LoadBalancer before deleting it, otherwise if this is the last test cluster-teardown will shutdown the master and leak your lb resources","created_at":"2016-11-11T23:24:46Z","updated_at":"2016-11-11T23:24:46Z","html_url":"https://github.com/kubernetes/kubernetes/pull/36546#discussion_r87674591","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/87674591"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/36546#discussion_r87674591"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546","id":93056724,"html_url":"https://github.com/kubernetes/kubernetes/pull/36546","diff_url":"https://github.com/kubernetes/kubernetes/pull/36546.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/36546.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/36546","number":36546,"state":"open","locked":false,"title":"Adds e2e firewall test for LoadBalancer type service","user":{"login":"MrHohn","id":8681801,"avatar_url":"https://avatars.githubusercontent.com/u/8681801?v=3","gravatar_id":"","url":"https://api.github.com/users/MrHohn","html_url":"https://github.com/MrHohn","followers_url":"https://api.github.com/users/MrHohn/followers","following_url":"https://api.github.com/users/MrHohn/following{/other_user}","gists_url":"https://api.github.com/users/MrHohn/gists{/gist_id}","starred_url":"https://api.github.com/users/MrHohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrHohn/subscriptions","organizations_url":"https://api.github.com/users/MrHohn/orgs","repos_url":"https://api.github.com/users/MrHohn/repos","events_url":"https://api.github.com/users/MrHohn/events{/privacy}","received_events_url":"https://api.github.com/users/MrHohn/received_events","type":"User","site_admin":false},"body":"Fixes #25488.\r\nA part of #31827.\r\n\r\nThis PR adds e2e firewall test for LoadBalancer type service, details as below:\r\n- Verifies corresponding firewall rule has correct `sourceRanges`, `ports and protocols` and `target tags`.\r\n- Verifies requests can reach all expected instances.\r\n- Verifies requests can not reach instances that are not included.\r\n\r\nOverview of the test procedure:\r\n- Creates a LoadBalancer type service.\r\n- Validates the corresponding firewall rule.\r\n- Creates a DaemonSet of netexec pods as service backends.\r\n- Sends requests from outside of the cluster and examine hitting all instances in range.\r\n- Removes tags from one of the instances in order to get it out of firewall rule's range.\r\n- Sends requests from outside of the cluster and examine not hitting this instance.\r\n- Recovers tags for this instances and verifies its traffic is back.\r\n\r\n@bprashanth @bowei @thockin\r\n\r\n<!-- Reviewable:start -->\r\n\r\n---\r\nThis change is [<img src=\"https://reviewable.kubernetes.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/36546)\r\n<!-- Reviewable:end -->\r\n","created_at":"2016-11-09T23:08:48Z","updated_at":"2016-11-11T23:54:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07dd1c09c18b412b577d640d3f43f934bdac45a1","assignee":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"assignees":[{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/36546/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/f1a37498a8c8a314594cd08f323e26e85ed34259","head":{"label":"MrHohn:e2e-firewall","ref":"e2e-firewall","sha":"f1a37498a8c8a314594cd08f323e26e85ed34259","user":{"login":"MrHohn","id":8681801,"avatar_url":"https://avatars.githubusercontent.com/u/8681801?v=3","gravatar_id":"","url":"https://api.github.com/users/MrHohn","html_url":"https://github.com/MrHohn","followers_url":"https://api.github.com/users/MrHohn/followers","following_url":"https://api.github.com/users/MrHohn/following{/other_user}","gists_url":"https://api.github.com/users/MrHohn/gists{/gist_id}","starred_url":"https://api.github.com/users/MrHohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrHohn/subscriptions","organizations_url":"https://api.github.com/users/MrHohn/orgs","repos_url":"https://api.github.com/users/MrHohn/repos","events_url":"https://api.github.com/users/MrHohn/events{/privacy}","received_events_url":"https://api.github.com/users/MrHohn/received_events","type":"User","site_admin":false},"repo":{"id":63400047,"name":"kubernetes","full_name":"MrHohn/kubernetes","owner":{"login":"MrHohn","id":8681801,"avatar_url":"https://avatars.githubusercontent.com/u/8681801?v=3","gravatar_id":"","url":"https://api.github.com/users/MrHohn","html_url":"https://github.com/MrHohn","followers_url":"https://api.github.com/users/MrHohn/followers","following_url":"https://api.github.com/users/MrHohn/following{/other_user}","gists_url":"https://api.github.com/users/MrHohn/gists{/gist_id}","starred_url":"https://api.github.com/users/MrHohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrHohn/subscriptions","organizations_url":"https://api.github.com/users/MrHohn/orgs","repos_url":"https://api.github.com/users/MrHohn/repos","events_url":"https://api.github.com/users/MrHohn/events{/privacy}","received_events_url":"https://api.github.com/users/MrHohn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MrHohn/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/MrHohn/kubernetes","forks_url":"https://api.github.com/repos/MrHohn/kubernetes/forks","keys_url":"https://api.github.com/repos/MrHohn/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MrHohn/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MrHohn/kubernetes/teams","hooks_url":"https://api.github.com/repos/MrHohn/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/MrHohn/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/MrHohn/kubernetes/events","assignees_url":"https://api.github.com/repos/MrHohn/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/MrHohn/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/MrHohn/kubernetes/tags","blobs_url":"https://api.github.com/repos/MrHohn/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MrHohn/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MrHohn/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/MrHohn/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MrHohn/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/MrHohn/kubernetes/languages","stargazers_url":"https://api.github.com/repos/MrHohn/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/MrHohn/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/MrHohn/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/MrHohn/kubernetes/subscription","commits_url":"https://api.github.com/repos/MrHohn/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/MrHohn/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/MrHohn/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/MrHohn/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/MrHohn/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/MrHohn/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MrHohn/kubernetes/merges","archive_url":"https://api.github.com/repos/MrHohn/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MrHohn/kubernetes/downloads","issues_url":"https://api.github.com/repos/MrHohn/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/MrHohn/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/MrHohn/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/MrHohn/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MrHohn/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/MrHohn/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/MrHohn/kubernetes/deployments","created_at":"2016-07-15T07:10:33Z","updated_at":"2016-07-19T07:20:43Z","pushed_at":"2016-11-11T23:28:54Z","git_url":"git://github.com/MrHohn/kubernetes.git","ssh_url":"git@github.com:MrHohn/kubernetes.git","clone_url":"https://github.com/MrHohn/kubernetes.git","svn_url":"https://github.com/MrHohn/kubernetes","homepage":"http://kubernetes.io","size":351826,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"6ea9ff68c895e5aafa1cf5f6b1b8562055a09abd","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":"2016-11-11T21:24:31Z","pushed_at":"2016-11-11T23:53:45Z","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":628709,"stargazers_count":18349,"watchers_count":18349,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6022,"mirror_url":null,"open_issues_count":5256,"forks":6022,"open_issues":5256,"watchers":18349,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/36546"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/36546"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/36546/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/36546/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/f1a37498a8c8a314594cd08f323e26e85ed34259"}}}}
{"actor":{"display_login":"bprashanth"}}