-
Notifications
You must be signed in to change notification settings - Fork 274
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
Service LB SKU support(reconcile path) #7138
base: master
Are you sure you want to change the base?
Service LB SKU support(reconcile path) #7138
Conversation
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. 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-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kartickmsft The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @kartickmsft! |
Hi @kartickmsft. Thanks for your PR. I'm waiting for a kubernetes-sigs 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-sigs/prow repository. |
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.
I'd opt for more return statements and less nesting, but LGTM overall
|
||
if az.useServiceLoadBalancer() { | ||
//If Interger value of TargetPort is present in the service, use it as the backend port. | ||
//We current don't support string(named Port). |
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.
What will happen if we hit this? Shouldn't we error out?
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.
I think better to error out as we are overridding the customer intent.
@@ -409,7 +409,7 @@ func getLocalServiceBackendPoolName(serviceName string, ipv6 bool) string { | |||
// getBackendPoolNameForService determine the expected backend pool name | |||
// by checking the external traffic policy of the service. | |||
func (az *Cloud) getBackendPoolNameForService(service *v1.Service, clusterName string, ipv6 bool) string { | |||
if !isLocalService(service) || !az.useMultipleStandardLoadBalancers() { | |||
if !isLocalService(service) || (!az.useMultipleStandardLoadBalancers() && !az.useServiceLoadBalancer()) { |
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.
Can we reverse this if? I think it will be much simpler to read.
@@ -409,7 +409,7 @@ func getLocalServiceBackendPoolName(serviceName string, ipv6 bool) string { | |||
// getBackendPoolNameForService determine the expected backend pool name | |||
// by checking the external traffic policy of the service. | |||
func (az *Cloud) getBackendPoolNameForService(service *v1.Service, clusterName string, ipv6 bool) string { | |||
if !isLocalService(service) || !az.useMultipleStandardLoadBalancers() { |
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.
Didn't we say that we should ignore local/not local for service sku? Now the name will vary based on that setting
@@ -409,7 +409,7 @@ func getLocalServiceBackendPoolName(serviceName string, ipv6 bool) string { | |||
// getBackendPoolNameForService determine the expected backend pool name | |||
// by checking the external traffic policy of the service. | |||
func (az *Cloud) getBackendPoolNameForService(service *v1.Service, clusterName string, ipv6 bool) string { | |||
if !isLocalService(service) || !az.useMultipleStandardLoadBalancers() { | |||
if !isLocalService(service) || (!az.useMultipleStandardLoadBalancers() && !az.useServiceLoadBalancer()) { | |||
return getBackendPoolName(clusterName, ipv6) | |||
} | |||
return getLocalServiceBackendPoolName(getServiceName(service), ipv6) |
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.
Can service name be longer than allowed backend pool name? Should we use uuid instead?
/* Remove all addresses from the backend pool and add the addresses from all the | ||
endpoint-slices pertaining to a service.*/ | ||
if strings.EqualFold(ptr.Deref(backendPool.Name, ""), lbBackendPoolName) && | ||
backendPool.BackendAddressPoolPropertiesFormat != 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.
Can we escape early to avoid nesting? Also, should we handle the error case that "if" checks here?
klog.V(6).Infof("bpi.EnsureHostsInPool: adding ip address %s", address) | ||
podIPsToBeAdded = append(podIPsToBeAdded, address) | ||
endpointsliceName = strings.ToLower(fmt.Sprintf("%s/%s", ES.Namespace, ES.Name)) | ||
endpointSliceNames = append(endpointSliceNames,endpointsliceName) |
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.
Should this be added for every address?
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.
A new property is used in the Address for the slice/ipgroup name if we use the old createOrUpdateBackendPool API. I think we don't need to populate this field if we the updateBackendIpGroup API.
var changed bool | ||
addresses := *backendPool.LoadBalancerBackendAddresses | ||
for _, ipAddress := range podIPAddresses { | ||
if !hasIPAddressInBackendPool(backendPool, ipAddress) { |
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.
Can we do a duplicate check earlier instead of scanning the pool with each add?
} | ||
|
||
backendPrivateIPv4s, backendPrivateIPv6s := utilsets.NewString(), utilsets.NewString() | ||
for _, bp := range *lb.BackendAddressPools { |
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.
Can we reduce nesting a little in this func?
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.
sure
endpoint-slices pertaining to a service.*/ | ||
if strings.EqualFold(ptr.Deref(backendPool.Name, ""), lbBackendPoolName) && | ||
backendPool.BackendAddressPoolPropertiesFormat != nil { | ||
if backendPool.LoadBalancerBackendAddresses == 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.
Do we need these checks? removeNodeIPAddressesFromBackendPool
checks already and addPodIPAddressesToBackendPool
inits it as well.
Co-authored-by: David Kowalski <[email protected]>
PR needs rebase. 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-sigs/prow repository. |
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: