Skip to content

Commit

Permalink
Merge pull request #3029 from vito/cni-conflist
Browse files Browse the repository at this point in the history
support .conflist CNI configs
  • Loading branch information
tonistiigi authored Aug 20, 2022
2 parents 35fb6c8 + 6f68930 commit cdd7d20
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 cdd7d20

Please sign in to comment.