@@ -2361,17 +2361,22 @@ func (ln *linuxNetworking) getKubeDummyInterface() (netlink.Link, error) {
23612361
23622362// Cleanup cleans all the configurations (IPVS, iptables, links) done
23632363func (nsc * NetworkServicesController ) Cleanup () {
2364- // cleanup ipvs rules by flush
2365- klog .Infof ("Cleaning up IPVS configuration permanently" )
2364+ klog .Infof ("Cleaning up NetworkServiceController configurations..." )
23662365
2366+ // cleanup ipvs rules by flush
23672367 handle , err := ipvs .New ("" )
23682368 if err != nil {
2369- klog .Errorf ("Failed to cleanup ipvs rules: %s" , err .Error ())
2370- return
2369+ klog .Errorf ("failed to get ipvs handle for cleaning ipvs definitions: %v" , err )
2370+ } else {
2371+ klog .Infof ("ipvs definitions don't have names associated with them for checking, during cleanup " +
2372+ "we assume that we own all of them and delete all ipvs definitions" )
2373+ err = handle .Flush ()
2374+ if err != nil {
2375+ klog .Errorf ("unable to flush ipvs tables: %v" , err )
2376+ }
2377+ handle .Close ()
23712378 }
23722379
2373- handle .Close ()
2374-
23752380 // cleanup iptables masquerade rule
23762381 err = deleteMasqueradeIptablesRule ()
23772382 if err != nil {
@@ -2401,7 +2406,8 @@ func (nsc *NetworkServicesController) Cleanup() {
24012406 return
24022407 }
24032408 }
2404- klog .Infof ("Successfully cleaned the ipvs configuration done by kube-router" )
2409+
2410+ klog .Infof ("Successfully cleaned the NetworkServiceController configuration done by kube-router" )
24052411}
24062412
24072413func (nsc * NetworkServicesController ) newEndpointsEventHandler () cache.ResourceEventHandler {
0 commit comments