-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support cross resource group load balancer. #81054
Conversation
Hi @nilo19. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/sig azure |
/ok-to-test |
return cloudprovider.DefaultLoadBalancerName(service) | ||
} | ||
|
||
func (az *Cloud) getLoadBalancerResourceGroup(service *v1.Service) string { | ||
if rgName, found := service.Annotations[ServiceAnnotationLoadBalancerResourceGroup]; found && strings.TrimSpace(rgName) != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add two new configuration options in Config
:
LoadBalancerName string `json:"loadBalancerName,omitempty" yaml:"loadBalancerName,omitempty"`
LoadBalancerResourceGroup string `json:"loadBalancerResourceGroup,omitempty" yaml:"loadBalancerResourceGroup,omitempty"`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, getLoadBalancerResourceGroup
could be
if az.LoadBalancerResourceGroup != "" {
return az.LoadBalancerResourceGroup
}
return az.ResourceGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for loadBalancerName. But notice az.LoadBalancerName
is only applied for defaultLBName (replace clusterName
when generating the LB name).
/retest |
/test pull-kubernetes-integration |
@@ -304,7 +307,8 @@ func (az *Cloud) listLBWithRetry(service *v1.Service) ([]network.LoadBalancer, e | |||
ctx, cancel := getContextWithCancel() | |||
defer cancel() | |||
|
|||
allLBs, retryErr = az.LoadBalancerClient.List(ctx, az.ResourceGroup) | |||
rgName := az.getLoadBalancerResourceGroup(service) | |||
allLBs, retryErr = az.LoadBalancerClient.List(ctx, rgName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also fix this on L457 and L478:
az.LoadBalancerClient.Delete(ctx, az.ResourceGroup, lbName)
@@ -282,7 +284,8 @@ func (az *Cloud) ListLB(service *v1.Service) ([]network.LoadBalancer, error) { | |||
ctx, cancel := getContextWithCancel() | |||
defer cancel() | |||
|
|||
allLBs, err := az.LoadBalancerClient.List(ctx, az.ResourceGroup) | |||
rgName := az.getLoadBalancerResourceGroup(service) | |||
allLBs, err := az.LoadBalancerClient.List(ctx, rgName) | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also use rgName in logs below.
return cloudprovider.DefaultLoadBalancerName(service) | ||
} | ||
|
||
func (az *Cloud) getLoadBalancerResourceGroup(service *v1.Service) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
param service is not used here, could we remove it?
// TODO: replace DefaultLoadBalancerName to generate more meaningful loadbalancer names. | ||
if az.LoadBalancerName != "" { | ||
return az.LoadBalancerName | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rollback the changes in L222-L224. The name here is used for frontendipconfigurations, service UID should be used so that different services configurations won't be conflicted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing. The corresponding codes have been fixed.
The resource group name on
az.getLoadBalancerResourceGroup()
|
d282513
to
0500dfd
Compare
/test pull-kubernetes-e2e-aks-engine-azure |
https://github.com/kubernetes/kubernetes/pull/81054/files#diff-4c5af42498de1d56820fcdbe9f860147R479 Please fix the resource group name here |
0500dfd
to
659e857
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feiskyer, nilo19 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks @nilo19. Please open a PR to update docs in cloud-provider-azure repo. |
/kind feature
What this PR does / why we need it:
Users want to reuse their existing LoadBalancer that are created in another resource group before the Kubernetes cluster is created.
Which issue(s) this PR fixes:
Fixes #78843
Does this PR introduce a user-facing change?: