-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Migrated pkg/proxy/ipvs to structured logging #104932
Migrated pkg/proxy/ipvs to structured logging #104932
Conversation
Hi @shivanshu1333. Thanks for your PR. I'm waiting for a kubernetes 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/test-infra repository. |
Remember to close them if this is merged. |
Yes, sure |
@danwinship, @rramkumar1 kindly review |
/wg structured-logging |
/auto-cc |
m.rsList.add(ele) | ||
return nil | ||
} | ||
|
||
func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, error) { | ||
klog.V(5).Infof("Trying to delete rs: %s", rsToDelete.String()) | ||
klog.V(5).InfoS("Trying to delete real server", "realServer", rsToDelete) |
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.
here I've removed .String()
as it is a helper function to convert real server to string.
Structured logging does this by default, and I've made every logging statement consistent with having "key" - "value" pairs.
-
log output using klog.V(5).InfoS("Deleting real server", "realServers", rsToDelete.String()). *
I0921 23:54:10.037778 58346 graceful_termination.go:173] "Deleting real server" realServer="1.1.1.1:80/tcp/10.0.0.1:80"
-
klog.V(5).InfoS("Deleting real server", "realServer", rsToDelete) *
I0921 23:56:34.439093 58827 graceful_termination.go:173] "Deleting real server" realServer="1.1.1.1:80/tcp/10.0.0.1:80"
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.
Thanks for testing this and providing examples! Looks better!
@serathius kindly re-review changes, thanks! |
/test pull-kubernetes-e2e-gci-gce-ipvs |
@@ -167,10 +167,10 @@ func (m *GracefulTerminationManager) deleteRsFunc(rsToDelete *listItem) (bool, e | |||
// (existing connections will be deleted on the next packet because sysctlExpireNoDestConn=1) | |||
// For other protocols, don't delete until all connections have expired) | |||
if utilipvs.IsRsGracefulTerminationNeeded(rsToDelete.VirtualServer.Protocol) && rs.ActiveConn+rs.InactiveConn != 0 { | |||
klog.V(5).Infof("Not deleting, RS %v: %v ActiveConn, %v InactiveConn", rsToDelete.String(), rs.ActiveConn, rs.InactiveConn) | |||
klog.V(5).InfoS("Not deleting real server, active connection, and inactive connection", "realServer", rsToDelete, "realServerActiveConnection", rs.ActiveConn, "realServerInactiveConnection", rs.InactiveConn) |
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.
klog.V(5).InfoS("Not deleting real server, active connection, and inactive connection", "realServer", rsToDelete, "realServerActiveConnection", rs.ActiveConn, "realServerInactiveConnection", rs.InactiveConn) | |
klog.V(5).InfoS("Skip deleting real server till all connection have expired", "realServer", rsToDelete, "activeConnection", rs.ActiveConn, "inactiveConnection", rs.InactiveConn) |
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.
Ahh yes, this is better
pkg/proxy/ipvs/ipset.go
Outdated
@@ -191,13 +191,13 @@ func ensureIPSet(set *IPSet) error { | |||
func checkMinVersion(vstring string) bool { | |||
version, err := utilversion.ParseGeneric(vstring) | |||
if err != nil { | |||
klog.Errorf("vstring (%s) is not a valid version string: %v", vstring, err) | |||
klog.ErrorS(err, "Vstring is not a valid version string", "versionString", vstring) |
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.
klog.ErrorS(err, "Vstring is not a valid version string", "versionString", vstring) | |
klog.ErrorS(err, "Got invalid version string", "versionString", vstring) |
mentioning name of variable in logs is not useful as simple rename will result in this log line not making sense.
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.
Yes, makes sense, thanks!
pkg/proxy/ipvs/ipset.go
Outdated
return false | ||
} | ||
|
||
minVersion, err := utilversion.ParseGeneric(MinIPSetCheckVersion) | ||
if err != nil { | ||
klog.Errorf("MinCheckVersion (%s) is not a valid version string: %v", MinIPSetCheckVersion, err) | ||
klog.ErrorS(err, "MinCheckVersion is not a valid version string", "minCheckVersion", MinIPSetCheckVersion) |
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.
klog.ErrorS(err, "MinCheckVersion is not a valid version string", "minCheckVersion", MinIPSetCheckVersion) | |
klog.ErrorS(err, "Got invalid version string", "versionString", MinIPSetCheckVersion) |
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.
Yes, it's similar to the previous suggestion, fixed it too, thank you very much for suggesting, slowly I'm getting better at this :)
/retest |
@serathius kindly re-review, thanks! |
/lgtm |
pinging @thockin for suggestions/approval |
/cc @aojea |
/label tide/merge-method-squash |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, shivanshu1333 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 |
* migrated ipset.go * migrated graceful_termination.go * fixed vstring * fixed ip set entry, made it consistent * fixed rs logging * resolving review comments for key graceful_termination.go * refactoring ipset.go * included review changes
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Migrate pkg/proxy/ipvs to structured logging
Which issue(s) this PR fixes:
Fixes #
Ref #104872
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: