-
Notifications
You must be signed in to change notification settings - Fork 303
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
Allow modifying trafficPolicy for L4 ILB services #1191
Conversation
pkg/neg/manager.go
Outdated
Subset: servicePortKey.Subset, | ||
SubsetLabels: portInfo.SubsetLabels, | ||
NegType: networkEndpointType, | ||
RandomizeEndpoints: portInfo.RandomizeEndpoints, |
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.
How about using the some representation of EndpointCalculator here?
FOr example types.L4LocalMode
?
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.
done. Also fixed the other comments.
pkg/neg/types/types.go
Outdated
// RandomizeEndpoints indicates if the endpoints for the NEG associated with this port need to | ||
// be selected at random, rather than selecting the endpoints of this service. This is applicable | ||
// in GCE_VM_IP NEGs where the endpoints are the nodes instead of pods. | ||
RandomizeEndpoints bool |
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.
Try to generalize this into a enum
@@ -85,8 +85,10 @@ func (l *LocalL4ILBEndpointsCalculator) CalculateEndpoints(ep *v1.Endpoints, cur | |||
} | |||
} | |||
if numEndpoints == 0 { | |||
// TODO verify the behavior seen by a client when accessing an ILB whose NEGs have no endpoints. | |||
return nil, nil, nil | |||
// pick upto 3 nodes at random to send "ConnectionRefused" response to clients. |
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 am wondering what happened when the ILB has no backends?
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.
The requests to VIP will timeout instead of getting Connection Refused immediately. This is a regression from the k/k implementation where "ICMP Connection Refused" is returned.
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.
Not sure if it is worth introducing this complication. Recommend leaving this out from this fix.
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.
done
|
||
nodeZoneMap := make(map[string][]*v1.Node) | ||
func getZoneNodesMap(nodes []*v1.Node, zonegetter types.ZoneGetter) map[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.
add comment
387db86
to
cd9eb11
Compare
This is neeeded to identify a service TrafficPolicy change as an event to stop the old syncer and start a new one with the new mode. This is relevant only for VM_IP NEGs. The field will have the value "L7" for the VM_IP_PORT NEGs. Changed portInfoMap as well.
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 overall
just one question left
@@ -527,7 +527,7 @@ func (c *Controller) mergeVmIpNEGsPortInfo(service *apiv1.Service, name types.Na | |||
// Update usage metrics. | |||
negUsage.VmIpNeg = usage.NewVmIpNegType(onlyLocal) | |||
|
|||
return portInfoMap.Merge(negtypes.NewPortInfoMapForVMIPNEG(name.Namespace, name.Name, c.namer, !onlyLocal)) | |||
return portInfoMap.Merge(negtypes.NewPortInfoMapForVMIPNEG(name.Namespace, name.Name, c.namer, onlyLocal)) |
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 is this changed? Do you want to enable readiness feedback?
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.
The change is because i was previously using this parameter as "randomizeEndpoints" boolean. RandomizeEndpoints is true for Cluster traffic Policy and false for Local traffic policy. This is not the readiness gate boolean.
ingress-gce/pkg/neg/types/types.go
Line 161 in 332d3e0
func NewPortInfoMapForVMIPNEG(namespace, name string, namer NetworkEndpointGroupNamer, randomize bool) PortInfoMap { |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: freehan, prameshj 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 |
Switching from Local to Cluster trafficPolicy (or vice versa) should change the endpoints calculator mode.
Also added logic to pick a random subset of upto 3 nodes in case of Local mode, with no endpoints. With this change, accessing the VIP will return "Connection refused" immediately, instead of timing out after a few seconds.
The behavior is unchanged for cases where there are endpoints.
/assign @freehan