-
Notifications
You must be signed in to change notification settings - Fork 195
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
L4 ILB - skip nodes from the non default network if multi subnet is t… #679
base: master
Are you sure you want to change the base?
Conversation
This issue is currently awaiting triage. If the repository mantainers determine this is a relevant issue, they will accept it by applying the The 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. |
/assign @cezarygerard |
e2f6c4c
to
c445469
Compare
/assign @code-elinka |
@@ -254,6 +256,37 @@ func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v | |||
return status, 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 you add a comment why it is needed
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.
Oh nvm, I see the comment in the usage
/approve |
} | ||
if !hasInstanceForNode(instances, nodes[2]) { | ||
t.Errorf("expected n3 to be in instances but it contained %+v", instanceURLs) | ||
} |
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.
check also
if hasInstanceForNode(instances, nodes[3]) {
t.Errorf("unexpected n4 in instances ...
}
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.
modified. there was a size check as well so it sort of checked it before
lgtm overall, one comment on unit test |
cc9d3d7
to
68ae610
Compare
/lgtm |
/approve |
/assign cheftako |
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cezarygerard, code-elinka, mmamczur 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 |
/assign @basantsa1989 |
@mmamczur: GitHub didn't allow me to assign the following users: basantsa1989. Note that only kubernetes members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
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. |
/lgtm |
@basantsa1989: changing LGTM is restricted to collaborators In response to this:
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. |
// Extract the subnet name from the URL. | ||
// example: for `https://www.googleapis.com/compute/v1/projects/project/regions/us-central1/subnetworks/defaultSubnet` | ||
// this will return `defaultSubnet`. | ||
func subnetNameFromURL(url string) 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.
This should have its own unit test.
This func should return an error instead of empty string if it fails to parse instead of eating the error.
@@ -254,6 +256,37 @@ func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v | |||
return status, nil | |||
} | |||
|
|||
func filterOutNodesFromNonDefaultNetworks(nodes []*v1.Node, defaultSubnetURL string) []*v1.Node { |
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 change the name, it's very long and it's not specific to defaultSubnet. I recommend changing this func to this:
func removeNodesWithSubnetName(nodes []*v1.Node, subnetName string) []*v1.Node.
This should have its own unit test (TestFilterOutNodesFromN...)
Parse the subnet URL outside this func.
// Filter out any node that is not from the default network. This is required for multi-subnet feature. | ||
// This should not change behavior for nodes that are in the default network. | ||
// This can't be done earlier when listing node since the code is shared between internal and external LBs. | ||
nodes = filterOutNodesFromNonDefaultNetworks(nodes, g.SubnetworkURL()) |
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.
We need to handle SubnetworkURL parse failure, even if we think it's rare.
subnetLabel, ok := node.Labels[labelGKESubnetworkName] | ||
|
||
if !ok && node.Spec.PodCIDR == "" { | ||
continue |
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.
This actually deserves a comment as why this is skipped when PodCIDR == ""
if !ok && node.Spec.PodCIDR == "" { | ||
continue | ||
} | ||
if ok && subnetLabel != "" && subnetLabel != subnetNameFromURL(defaultSubnetURL) { |
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.
Why would subnetNameFromURL == "" ever?
/hold |
/triage-accepted |
@@ -50,6 +50,8 @@ const ( | |||
maxInstancesPerInstanceGroup = 1000 | |||
// maxL4ILBPorts is the maximum number of ports that can be specified in an L4 ILB Forwarding Rule. Beyond this, "AllPorts" field should be used. | |||
maxL4ILBPorts = 5 | |||
// labelGKESubnetworkName is the key of the label that contains the subnet name the node is connected to. | |||
labelGKESubnetworkName = "cloud.google.com/gke-np-subnet" |
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.
Is it too late to remove the abbreviation here?
gke-np-subnet => gke-node-pool-subnet
…urned on.
This will just skip nodes that are not on the default network when creating the instance group.