Skip to content

Commit

Permalink
fix(NRC): reduce logging for egress cleanup errors
Browse files Browse the repository at this point in the history
Errors can happen here for a lot of reasons, the user may not have been
running the controller, the definitions may have already been deleted,
the ipset may not be around to be referenced because the user already
cleaned up before.

Reduced the logging to trim user confusion over error statements in the
logs.
  • Loading branch information
aauren committed Aug 5, 2021
1 parent fb07026 commit cafd69d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/controllers/routing/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,15 +676,19 @@ func (nrc *NetworkRoutingController) setupOverlayTunnel(tunnelName string, nextH

// Cleanup performs the cleanup of configurations done
func (nrc *NetworkRoutingController) Cleanup() {
klog.Infof("Cleaning up NetworkRoutesController configurations")

// Pod egress cleanup
err := nrc.deletePodEgressRule()
if err != nil {
klog.Warningf("Error deleting Pod egress iptables rule: %s", err.Error())
// Changing to level 1 logging as errors occur when ipsets have already been cleaned and needlessly worries users
klog.V(1).Infof("Error deleting Pod egress iptables rule: %v", err)
}

err = nrc.deleteBadPodEgressRules()
if err != nil {
klog.Warningf("Error deleting Pod egress iptables rule: %s", err.Error())
// Changing to level 1 logging as errors occur when ipsets have already been cleaned and needlessly worries users
klog.V(1).Infof("Error deleting Pod egress iptables rule: %s", err.Error())
}

// delete all ipsets created by kube-router
Expand Down Expand Up @@ -713,6 +717,8 @@ func (nrc *NetworkRoutingController) Cleanup() {
if err != nil {
klog.Warningf("Error deleting ipset: %s", err.Error())
}

klog.Infof("Successfully cleaned the NetworkRoutesController configuration done by kube-router")
}

func (nrc *NetworkRoutingController) syncNodeIPSets() error {
Expand Down

0 comments on commit cafd69d

Please sign in to comment.