Skip to content

Commit

Permalink
support .conflist CNI configs
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
  • Loading branch information
vito committed Aug 16, 2022
1 parent 7b2c27c commit 6f68930
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion util/network/cniprovider/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os"
"runtime"
"strings"

cni "github.com/containerd/go-cni"
"github.com/gofrs/flock"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6f68930

Please sign in to comment.