Merge pull request #3029 from vito/cni-conflist

support .conflist CNI configs
This commit is contained in:
Tõnis Tiigi
2022-08-19 18:30:39 -07:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ import (
"context"
"os"
"runtime"
"strings"
cni "github.com/containerd/go-cni"
"github.com/gofrs/flock"
@@ -35,7 +36,11 @@ func New(opt Opt) (network.Provider, error) {
cniOptions = append(cniOptions, cni.WithLoNetwork)
}
cniOptions = append(cniOptions, cni.WithConfFile(opt.ConfigPath))
if strings.HasSuffix(opt.ConfigPath, ".conflist") {
cniOptions = append(cniOptions, cni.WithConfListFile(opt.ConfigPath))
} else {
cniOptions = append(cniOptions, cni.WithConfFile(opt.ConfigPath))
}
cniHandle, err := cni.New(cniOptions...)
if err != nil {