-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve install_cni_chaining to support updates to CNI conf file (#4012)
The script is in charge of overwriting the cloud-specific CNI conf file (e.g., 10-aws.conf for EKS). However, the script is currently run as an initContainer, and does not account for the possibility that the CNI conf file may be modified again by the cloud provider at a later time, hence discarding the changes made by the script. For example, restarting aws-node on EKS will cause the 10-aws.conf file to be overwritten with the default configuration, and Antrea will no longer be involved in Pod networking configuration. For the user, everything may appear to work from a connectivity standpoint, but NetworkPolicies will not be enforced! To avoid this issue, we run install_cni_chaining in a "normal" container, and leverage inotify to monitor the CNI conf file. Every time another process writes to the file, we process it one more time and update it again if necessary. This solution is not perfect. I think that there is a small possibility of race conditions, but they remain very unlikely. One example is this sequence of events: 1. aws-node overwrites the CNI conf file (because of a restart?) 2. a new Pod is created on the Node, the Antrea CNI is not used 3. install_cni_chaining updates the CNI conf file and adds Antrea to the chain Avoiding this race would require some major changes (e.g., to antrea-eks-node-init). Because changes to the CNI conf file are *very* infrequent, I think this is acceptable. This solution is loosely based on the linkerd CNI installation script: https://github.com/linkerd/linkerd2/blob/main/cni-plugin/deployment/scripts/install-cni.sh Fixes #3974 Signed-off-by: Antonin Bas <[email protected]>
- Loading branch information
1 parent
1655f9f
commit 231b09d
Showing
5 changed files
with
141 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters