-
Notifications
You must be signed in to change notification settings - Fork 306
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
add logging in NEG syncer #1155
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,7 +177,7 @@ func toZoneNetworkEndpointMap(endpoints *apiv1.Endpoints, zoneGetter negtypes.Zo | |
klog.Errorf("Endpoint object is nil") | ||
return zoneNetworkEndpointMap, networkEndpointPodMap, nil | ||
} | ||
|
||
var foundMatchingPort bool | ||
for _, subset := range endpoints.Subsets { | ||
matchPort := "" | ||
// service spec allows target Port to be a named Port. | ||
|
@@ -193,6 +193,7 @@ func toZoneNetworkEndpointMap(endpoints *apiv1.Endpoints, zoneGetter negtypes.Zo | |
if len(matchPort) == 0 { | ||
continue | ||
} | ||
foundMatchingPort = true | ||
|
||
// processAddressFunc adds the qualified endpoints from the input list into the endpointSet group by zone | ||
processAddressFunc := func(addresses []v1.EndpointAddress, includeAllEndpoints bool) error { | ||
|
@@ -244,6 +245,13 @@ func toZoneNetworkEndpointMap(endpoints *apiv1.Endpoints, zoneGetter negtypes.Zo | |
return nil, nil, err | ||
} | ||
} | ||
if !foundMatchingPort { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a log at line 209 as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to that. Also, we can move this log line to line 194? At that point, we know foundMatchingPort is false right? Or if we want this approach, we need to reset foundMatchingPort to false in line 250. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please disregard my comment about moving the log to a different line. It makes sense to keep it the way you have it - we only want this log if no endpoints had the matching port. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added another log line when the output is empty. |
||
klog.Errorf("Service port name %q was not found in the endpoints object %+v", servicePortName, endpoints) | ||
} | ||
|
||
if len(zoneNetworkEndpointMap) == 0 || len(networkEndpointPodMap) == 0 { | ||
klog.V(3).Infof("Generated empty endpoint maps (zoneNetworkEndpointMap: %+v, networkEndpointPodMap: %v) from Endpoints object: %+v", zoneNetworkEndpointMap, networkEndpointPodMap, endpoints) | ||
} | ||
return zoneNetworkEndpointMap, networkEndpointPodMap, 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.
This would log endpoints twice in case of VM_IP NEGs, see line 172. Maybe we can remove line 172 and log include s.NegType in this function.