Skip to content

Commit

Permalink
iptables: Do not block in case of a failed reconciliation
Browse files Browse the repository at this point in the history
In case of a failed iptables reconciliation, unblock the waiting
goroutines closing the channel. This is done to avoid keeping the
consumer goroutines stuck forever and potentially blocking other and
more important agent operations.

In case of an error, the reconciler retries the iptables rules update at
a later time, in order to achieve eventual consistency.

Signed-off-by: Fabio Falzoi <[email protected]>
  • Loading branch information
pippolo84 authored and julianwiedmann committed Apr 16, 2024
1 parent 9ddfdf7 commit 316e126
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/datapath/iptables/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,15 @@ stop:
health.OK("iptables rules full reconciliation completed")
firstInit = false
stateChanged = false
// close all channels waiting for reconciliation
for _, ch := range updatedChs {
close(ch)
}
updatedChs = updatedChs[:0]
}

// close all channels waiting for reconciliation
// do this even in case of a failed reconciliation, to avoid
// blocking consumer goroutines indefinitely.
for _, ch := range updatedChs {
close(ch)
}
updatedChs = updatedChs[:0]
}
}

Expand Down

0 comments on commit 316e126

Please sign in to comment.