kube-proxy: do not delete previously stale but currently active chains
In some cases a chain could change from stale to active, but once it's added to staleChains it would always be deleted once. When the proxier tries to delete a previously stale but currently active chain, it would fail and lead to errors, though it won't cause real problem thanks to kernel's validation. The commit removes a chain from staleChains if it becomes active. Signed-off-by: Quan Tian <qtian@vmware.com>
This commit is contained in:
@@ -1525,11 +1525,15 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
existingChains, err := proxier.nftables.List(context.TODO(), "chains")
|
||||
if err == nil {
|
||||
for _, chain := range existingChains {
|
||||
if isServiceChainName(chain) && !activeChains.Has(chain) {
|
||||
tx.Flush(&knftables.Chain{
|
||||
Name: chain,
|
||||
})
|
||||
proxier.staleChains[chain] = start
|
||||
if isServiceChainName(chain) {
|
||||
if !activeChains.Has(chain) {
|
||||
tx.Flush(&knftables.Chain{
|
||||
Name: chain,
|
||||
})
|
||||
proxier.staleChains[chain] = start
|
||||
} else {
|
||||
delete(proxier.staleChains, chain)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if !knftables.IsNotFound(err) {
|
||||
|
Reference in New Issue
Block a user