Merge pull request #9046 from tstromberg/cni-true

Allow flannel CNI to work with kicbase by fixing IP conflict
pull/9052/head
Thomas Strömberg 2020-08-21 13:38:39 -07:00 committed by GitHub
commit f492215009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -18,9 +18,12 @@ package cni
import (
"os/exec"
"path/filepath"
"github.com/golang/glog"
"github.com/pkg/errors"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
)
// From https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
@ -646,6 +649,14 @@ func (c Flannel) Apply(r Runner) error {
return errors.Wrap(err, "required 'portmap' CNI plug-in not found")
}
if driver.IsKIC(c.cc.Driver) {
conflict := "/etc/cni/net.d/100-crio-bridge.conf"
_, err := r.RunCmd(exec.Command("sudo", "mv", conflict, filepath.Join(filepath.Dir(conflict), "DISABLED-"+filepath.Base(conflict))))
if err != nil {
glog.Errorf("unable to disable %s: %v", conflict, err)
}
}
return applyManifest(c.cc, r, manifestAsset([]byte(flannelTmpl)))
}