network: add cleanupOrphanTaps() to remove orphan TAPs by carrier state #407
+65
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cleanupOrphanTaps()at the start ofDynamicNetwork.NetworkSetup().cleanupOrphanTaps()(new): scan current netns for interfaces matching^tap.*_urunc$and use kernel carrier/operational state as the sole criterion:Description
In kubernetes setups when a pod is getting restarted, the network namespace (created by the pause container) remains active and hence the tap0_urunc device still exists. Therefore, when urunc (re)creates the container it identifies the tap0_urunc device and it does not recreates it.
Related issues
tap*_uruncleft after urunc restart in Kubernetes, preventing NetworkSetup #406How was this tested?
Then observe the Pod status and restart:
LLM usage
I use LLM to disscuss how to identify a orphan tap device.
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).