Skip to content
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

Merged
merged 1 commit into from
Jun 15, 2020
Merged

add logging in NEG syncer #1155

merged 1 commit into from
Jun 15, 2020

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Jun 12, 2020

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 12, 2020
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 12, 2020
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 12, 2020
@@ -244,6 +245,9 @@ func toZoneNetworkEndpointMap(endpoints *apiv1.Endpoints, zoneGetter negtypes.Zo
return nil, nil, err
}
}
if !foundMatchingPort {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a log at line 209 as well?

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added another log line when the output is empty.


targetMap, endpointPodMap, err := s.endpointsCalculator.CalculateEndpoints(ep.(*apiv1.Endpoints), currentMap)
s.logStats(currentMap, "desired NEG endpoints")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetMap?

@@ -244,6 +245,9 @@ func toZoneNetworkEndpointMap(endpoints *apiv1.Endpoints, zoneGetter negtypes.Zo
return nil, nil, err
}
}
if !foundMatchingPort {
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

@@ -185,7 +189,8 @@ func (s *transactionSyncer) syncInternal() error {
klog.V(4).Infof("No endpoint change for %s/%s, skip syncing NEG. ", s.Namespace, s.Name)
return nil
}

s.logEndpoints(addEndpoints, "adding endpoint")
s.logEndpoints(removeEndpoints, "removing endpoint")
Copy link
Contributor

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.

func (s *transactionSyncer) logEndpoints(endpointMap map[string]negtypes.NetworkEndpointSet, desc string) {
for zone, endpointSet := range endpointMap {
for _, endpoint := range endpointSet.List() {
klog.V(3).Infof("For NEG %q, %s: %+v to zone %q", s.negName, desc, endpoint, zone)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we log the entire map instead of each endpoint? The map key will have the zone and the value will be the list of endpoints?


// logEndpoints logs individual endpoint in the input endpointMap
func (s *transactionSyncer) logEndpoints(endpointMap map[string]negtypes.NetworkEndpointSet, desc string) {
klog.V(3).Infof("For NEG %q, %s: %+v", endpointMap)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's include s.negName and s.NegType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log line when the syncerInternal starts includes everything. I feel like you can reference it by searching the neg name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true.. this log line needs more params though. Maybe you meant to include "desc" and s.negName? It might be nice to see the negType here too, but we can lookup from name as well.

@prameshj
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 15, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 35e155c into kubernetes:master Jun 15, 2020
k8s-ci-robot added a commit that referenced this pull request Jun 15, 2020
Cherrypicking #1155 into release 1.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants