-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch upstream issue where multus delegates to itself
and breaks pod networking by try multiple times to create the same interface. Issue fixed: rancher/rke2#4568
- Loading branch information
1 parent
83069ac
commit b9547ee
Showing
2 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff --git a/cmd/thin_entrypoint/main.go b/cmd/thin_entrypoint/main.go | ||
index ac721518..3f0e835f 100644 | ||
--- a/cmd/thin_entrypoint/main.go | ||
+++ b/cmd/thin_entrypoint/main.go | ||
@@ -23,7 +23,9 @@ import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
+ "path" | ||
"path/filepath" | ||
+ "regexp" | ||
"strings" | ||
"text/template" | ||
"time" | ||
@@ -294,7 +296,20 @@ func (o *Options) createMultusConfig() (string, error) { | ||
return "", fmt.Errorf("cannot find master CNI config in %q: %v", o.MultusAutoconfigDir, err) | ||
} | ||
|
||
- masterConfigPath := files[0] | ||
+ var masterConfigPath string | ||
+ // skip existing multus configuration file to avoid creating a situation | ||
+ // where multus delegates to itself and breaks pod networking | ||
+ multusRegexp, err := regexp.Compile("multus") | ||
+ if err != nil { | ||
+ return "", fmt.Errorf("regexp compilation failed: %v", err) | ||
+ } | ||
+ for _, filename := range files { | ||
+ if !multusRegexp.MatchString(path.Base(filename)) { | ||
+ masterConfigPath = filename | ||
+ break | ||
+ } | ||
+ } | ||
+ | ||
masterConfigBytes, err := os.ReadFile(masterConfigPath) | ||
if err != nil { | ||
return "", fmt.Errorf("cannot read master CNI config file %q: %v", masterConfigPath, err) |