Skip to content

Commit

Permalink
fix: return early when we might be holding nil references
Browse files Browse the repository at this point in the history
  • Loading branch information
aauren committed Apr 14, 2021
1 parent 4efa5cc commit 53cfbe3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/controllers/netpol/network_policy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ func (npc *NetworkPolicyController) Cleanup() {
iptablesCmdHandler, err := iptables.New()
if err != nil {
klog.Errorf("Failed to initialize iptables executor: %s", err.Error())
return
}

// delete jump rules in FORWARD chain to pod specific firewall chain
Expand Down Expand Up @@ -570,6 +571,7 @@ func (npc *NetworkPolicyController) Cleanup() {
ipset, err := utils.NewIPSet(false)
if err != nil {
klog.Errorf("Failed to clean up ipsets: " + err.Error())
return
}
err = ipset.Save()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions pkg/controllers/proxy/service_endpoints_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,6 @@ func (nsc *NetworkServicesController) cleanupStaleIPVSConfig(activeServiceEndpoi
// cleanup stale ipvs service and servers
klog.V(1).Info("Cleaning up if any, old ipvs service and servers which are no longer needed")

if err != nil {
return errors.New("Failed to list IPVS services: " + err.Error())
}
var protocol string
for _, ipvsSvc := range ipvsSvcs {
if ipvsSvc.Protocol == syscall.IPPROTO_TCP {
Expand Down
1 change: 1 addition & 0 deletions pkg/controllers/routing/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ func (nrc *NetworkRoutingController) Cleanup() {
ipset, err := utils.NewIPSet(nrc.isIpv6)
if err != nil {
klog.Errorf("Failed to clean up ipsets: " + err.Error())
return
}
err = ipset.Save()
if err != nil {
Expand Down

0 comments on commit 53cfbe3

Please sign in to comment.