{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/108091853","pull_request_review_id":29100297,"id":108091853,"diff_hunk":"@@ -157,14 +234,45 @@ func (az *Cloud) UpdateLoadBalancer(clusterName string, service *v1.Service, nod\n // have multiple underlying components, meaning a Get could say that the LB\n // doesn't exist even if some part of it is still laying around.\n func (az *Cloud) EnsureLoadBalancerDeleted(clusterName string, service *v1.Service) error {\n-\tlbName := getLoadBalancerName(clusterName)\n-\tpipName := getPublicIPName(clusterName, service)\n+\tisInternal := requiresInternalLoadBalancer(service)\n+\tlbName := getLoadBalancerName(clusterName, isInternal)\n \tserviceName := getServiceName(service)\n \n \tglog.V(2).Infof(\"delete(%s): START clusterName=%q lbName=%q\", serviceName, clusterName, lbName)\n \n-\t// reconcile logic is capable of fully reconcile, so we can use this to delete\n-\tservice.Spec.Ports = []v1.ServicePort{}\n+\taz.ensureLoadBalancerDeleted(clusterName, service, isInternal)\n+\n+\tsg, existsSg, err := az.getSecurityGroup()","path":"pkg/cloudprovider/providers/azure/azure_loadbalancer.go","position":186,"original_position":186,"commit_id":"31ab59312dd6c276b4f9e5ba7505f9a70b7b7f9e","original_commit_id":"31ab59312dd6c276b4f9e5ba7505f9a70b7b7f9e","user":{"login":"jinmiaoms","id":5395483,"avatar_url":"https://avatars0.githubusercontent.com/u/5395483?v=3","gravatar_id":"","url":"https://api.github.com/users/jinmiaoms","html_url":"https://github.com/jinmiaoms","followers_url":"https://api.github.com/users/jinmiaoms/followers","following_url":"https://api.github.com/users/jinmiaoms/following{/other_user}","gists_url":"https://api.github.com/users/jinmiaoms/gists{/gist_id}","starred_url":"https://api.github.com/users/jinmiaoms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinmiaoms/subscriptions","organizations_url":"https://api.github.com/users/jinmiaoms/orgs","repos_url":"https://api.github.com/users/jinmiaoms/repos","events_url":"https://api.github.com/users/jinmiaoms/events{/privacy}","received_events_url":"https://api.github.com/users/jinmiaoms/received_events","type":"User","site_admin":false},"body":"How about passing in another flag, say, \"cleanupSecurityGroup\" which defaults to true?  Another option is to pull the IP removal part out the original func also, and rename the overloaded one to something like \"deleteLoadBalancerOnly\" to avoid confusion.","created_at":"2017-03-27T05:13:14Z","updated_at":"2017-03-27T05:13:14Z","html_url":"https://github.com/kubernetes/kubernetes/pull/43510#discussion_r108091853","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/108091853"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/43510#discussion_r108091853"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510","id":111968938,"html_url":"https://github.com/kubernetes/kubernetes/pull/43510","diff_url":"https://github.com/kubernetes/kubernetes/pull/43510.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/43510.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/43510","number":43510,"state":"open","locked":false,"title":"Add support for Azure internal load balancer","user":{"login":"karataliu","id":10071498,"avatar_url":"https://avatars1.githubusercontent.com/u/10071498?v=3","gravatar_id":"","url":"https://api.github.com/users/karataliu","html_url":"https://github.com/karataliu","followers_url":"https://api.github.com/users/karataliu/followers","following_url":"https://api.github.com/users/karataliu/following{/other_user}","gists_url":"https://api.github.com/users/karataliu/gists{/gist_id}","starred_url":"https://api.github.com/users/karataliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karataliu/subscriptions","organizations_url":"https://api.github.com/users/karataliu/orgs","repos_url":"https://api.github.com/users/karataliu/repos","events_url":"https://api.github.com/users/karataliu/events{/privacy}","received_events_url":"https://api.github.com/users/karataliu/received_events","type":"User","site_admin":false},"body":"**Which issue this PR fixes**\r\nFixes https://github.com/kubernetes/kubernetes/issues/38901\r\n\r\n**What this PR does / why we need it**:\r\nThis PR is to add support for Azure internal load balancer\r\n\r\nCurrently when exposing a serivce with LoadBalancer type, Azure provider would assume that it requires a public load balancer.\r\nThus it will request a public IP address resource, and expose the service via that public IP.\r\nIn this case we're not able to apply private IP addresses (within the cluster virtual network) for the service.\r\n\r\n**Special notes for your reviewer**:\r\n1. Clarification:\r\na. 'LoadBalancer' refers to an option for 'type' field under ServiceSpec. See https://kubernetes.io/docs/resources-reference/v1.5/#servicespec-v1\r\nb. 'Azure LoadBalancer' refers a type of Azure resource. See https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-overview\r\n\r\n2. For a single Azure LoadBalancer, all frontend ip should reference either a subnet or publicIpAddress, which means that it could be either an Internet facing load balancer or an internal one.\r\nFor current provider, it would create an Azure LoadBalancer with generated '${loadBalancerName}' for all services with 'LoadBalancer' type.\r\nThis PR introduces name '${loadBalancerName}-internal' for a separate Azure Load Balancer resource, used by all the service that requires internal load balancers.\r\n\r\n3. This PR introduces a new annotation for the internal load balancer type behaviour:\r\na. When the annotaion value is set to 'false' or not set, it falls back to the original behaviour, assuming that user is requesting a public load balancer;\r\nb. When the annotaion value is set to 'true', the following rule applies depending on 'loadBalancerIP' field on ServiceSpec:\r\n   - If 'loadBalancerIP' is not set, it will create a load balancer rule with dynamic assigned frontend IP under the cluster subnet;\r\n   - If 'loadBalancerIP' is set, it will create a load balancer rule with the frontend IP set to the given value. If the given value is not valid, that is, it does not falls into the cluster subnet range, then the creation will fail.\r\n\r\n4. Users may change the load balancer type by applying the annotation to the service at runtime.\r\nIn this case, the load balancer rule would need to be 'switched' between the internal one and external one.\r\nFor example, it we have a service with internal load balancer, and then user removes the annotation, making it to a public one. Before we creating rules in the public Azure LoadBalancer, we'll need to clean up rules in the internal Azure LoadBalancer.\r\n\r\n**Release note**:","created_at":"2017-03-22T09:55:51Z","updated_at":"2017-03-27T05:13:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66e0a8071530ef51d4df41005a4f0c8ea4a355d4","assignee":{"login":"gmarek","id":1703842,"avatar_url":"https://avatars3.githubusercontent.com/u/1703842?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarek","html_url":"https://github.com/gmarek","followers_url":"https://api.github.com/users/gmarek/followers","following_url":"https://api.github.com/users/gmarek/following{/other_user}","gists_url":"https://api.github.com/users/gmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarek/subscriptions","organizations_url":"https://api.github.com/users/gmarek/orgs","repos_url":"https://api.github.com/users/gmarek/repos","events_url":"https://api.github.com/users/gmarek/events{/privacy}","received_events_url":"https://api.github.com/users/gmarek/received_events","type":"User","site_admin":false},"assignees":[{"login":"gmarek","id":1703842,"avatar_url":"https://avatars3.githubusercontent.com/u/1703842?v=3","gravatar_id":"","url":"https://api.github.com/users/gmarek","html_url":"https://github.com/gmarek","followers_url":"https://api.github.com/users/gmarek/followers","following_url":"https://api.github.com/users/gmarek/following{/other_user}","gists_url":"https://api.github.com/users/gmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/gmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmarek/subscriptions","organizations_url":"https://api.github.com/users/gmarek/orgs","repos_url":"https://api.github.com/users/gmarek/repos","events_url":"https://api.github.com/users/gmarek/events{/privacy}","received_events_url":"https://api.github.com/users/gmarek/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/43510/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/31ab59312dd6c276b4f9e5ba7505f9a70b7b7f9e","head":{"label":"karataliu:azurelb","ref":"azurelb","sha":"31ab59312dd6c276b4f9e5ba7505f9a70b7b7f9e","user":{"login":"karataliu","id":10071498,"avatar_url":"https://avatars1.githubusercontent.com/u/10071498?v=3","gravatar_id":"","url":"https://api.github.com/users/karataliu","html_url":"https://github.com/karataliu","followers_url":"https://api.github.com/users/karataliu/followers","following_url":"https://api.github.com/users/karataliu/following{/other_user}","gists_url":"https://api.github.com/users/karataliu/gists{/gist_id}","starred_url":"https://api.github.com/users/karataliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karataliu/subscriptions","organizations_url":"https://api.github.com/users/karataliu/orgs","repos_url":"https://api.github.com/users/karataliu/repos","events_url":"https://api.github.com/users/karataliu/events{/privacy}","received_events_url":"https://api.github.com/users/karataliu/received_events","type":"User","site_admin":false},"repo":{"id":85023755,"name":"kubernetes","full_name":"karataliu/kubernetes","owner":{"login":"karataliu","id":10071498,"avatar_url":"https://avatars1.githubusercontent.com/u/10071498?v=3","gravatar_id":"","url":"https://api.github.com/users/karataliu","html_url":"https://github.com/karataliu","followers_url":"https://api.github.com/users/karataliu/followers","following_url":"https://api.github.com/users/karataliu/following{/other_user}","gists_url":"https://api.github.com/users/karataliu/gists{/gist_id}","starred_url":"https://api.github.com/users/karataliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karataliu/subscriptions","organizations_url":"https://api.github.com/users/karataliu/orgs","repos_url":"https://api.github.com/users/karataliu/repos","events_url":"https://api.github.com/users/karataliu/events{/privacy}","received_events_url":"https://api.github.com/users/karataliu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/karataliu/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":true,"url":"https://api.github.com/repos/karataliu/kubernetes","forks_url":"https://api.github.com/repos/karataliu/kubernetes/forks","keys_url":"https://api.github.com/repos/karataliu/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karataliu/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karataliu/kubernetes/teams","hooks_url":"https://api.github.com/repos/karataliu/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/karataliu/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/karataliu/kubernetes/events","assignees_url":"https://api.github.com/repos/karataliu/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/karataliu/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/karataliu/kubernetes/tags","blobs_url":"https://api.github.com/repos/karataliu/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karataliu/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karataliu/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/karataliu/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karataliu/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/karataliu/kubernetes/languages","stargazers_url":"https://api.github.com/repos/karataliu/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/karataliu/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/karataliu/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/karataliu/kubernetes/subscription","commits_url":"https://api.github.com/repos/karataliu/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/karataliu/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/karataliu/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/karataliu/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/karataliu/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/karataliu/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karataliu/kubernetes/merges","archive_url":"https://api.github.com/repos/karataliu/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karataliu/kubernetes/downloads","issues_url":"https://api.github.com/repos/karataliu/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/karataliu/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/karataliu/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/karataliu/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karataliu/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/karataliu/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/karataliu/kubernetes/deployments","created_at":"2017-03-15T03:15:10Z","updated_at":"2017-03-15T03:15:41Z","pushed_at":"2017-03-27T04:59:34Z","git_url":"git://github.com/karataliu/kubernetes.git","ssh_url":"git@github.com:karataliu/kubernetes.git","clone_url":"https://github.com/karataliu/kubernetes.git","svn_url":"https://github.com/karataliu/kubernetes","homepage":"http://kubernetes.io","size":411229,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"9dae6a734a8cf39d3c4864dae181847c50c5a5dd","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars1.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://avatars1.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-03-27T04:37:57Z","pushed_at":"2017-03-27T05:08:13Z","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":588153,"stargazers_count":21813,"watchers_count":21813,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7520,"mirror_url":null,"open_issues_count":5552,"forks":7520,"open_issues":5552,"watchers":21813,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/43510"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/43510"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/43510/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/43510/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/31ab59312dd6c276b4f9e5ba7505f9a70b7b7f9e"}}}}
{"actor":{"display_login":"jinmiaoms"}}