mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-07-03 19:06:15 +00:00
fix multus config file generation to avoid self-delegation
Check masterConfigPath file and skip if it is multus generated files. Fix #1130
This commit is contained in:
parent
8d8aa80cd5
commit
159f2610c0
@ -305,7 +305,17 @@ func (o *Options) createMultusConfig() (string, error) {
|
||||
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)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot read master CNI config file %q: %v", masterConfigPath, err)
|
||||
|
Loading…
Reference in New Issue
Block a user