mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-08-31 08:33:06 +00:00
Merge pull request #1142 from s1061123/fix/1130
fix multus config file generation to avoid self-delegation
This commit is contained in:
@@ -305,7 +305,17 @@ func (o *Options) createMultusConfig() (string, error) {
|
|||||||
return "", fmt.Errorf("cannot find master CNI config in %q: %v", o.MultusAutoconfigDir, err)
|
return "", fmt.Errorf("cannot find master CNI config in %q: %v", o.MultusAutoconfigDir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
masterConfigPath := files[0]
|
masterConfigPath := ""
|
||||||
|
for _, filename := range files {
|
||||||
|
if !strings.HasPrefix(filepath.Base(filename), "00-multus.conf") {
|
||||||
|
masterConfigPath = filename
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if masterConfigPath == "" {
|
||||||
|
return "", fmt.Errorf("cannot find valid master CNI config in %q", o.MultusAutoconfigDir)
|
||||||
|
}
|
||||||
|
|
||||||
masterConfigBytes, err := os.ReadFile(masterConfigPath)
|
masterConfigBytes, err := os.ReadFile(masterConfigPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("cannot read master CNI config file %q: %v", masterConfigPath, err)
|
return "", fmt.Errorf("cannot read master CNI config file %q: %v", masterConfigPath, err)
|
||||||
|
Reference in New Issue
Block a user