File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -688,6 +688,14 @@ const (
688
688
CNICacheDir = "/var/lib/cni/cache"
689
689
)
690
690
691
+ func getCriDockerdPath (cr CommandRunner ) string {
692
+ rr , err := cr .RunCmd (exec .Command ("which" , "cri-dockerd" ))
693
+ if err != nil {
694
+ return "/usr/bin/cri-dockerd"
695
+ }
696
+ return strings .TrimSuffix (rr .Stdout .String (), "\n " )
697
+ }
698
+
691
699
func dockerConfigureNetworkPlugin (cr CommandRunner , networkPlugin string ) error {
692
700
// $ cri-dockerd --version
693
701
// cri-dockerd 0.2.6 (d8accf7)
@@ -702,17 +710,19 @@ func dockerConfigureNetworkPlugin(cr CommandRunner, networkPlugin string) error
702
710
networkPlugin = "cni"
703
711
}
704
712
opts := struct {
713
+ ExecPath string
705
714
NetworkPlugin string
706
715
ExtraArguments string
707
716
}{
717
+ ExecPath : getCriDockerdPath (cr ),
708
718
NetworkPlugin : networkPlugin ,
709
719
ExtraArguments : args ,
710
720
}
711
721
712
722
const CRIDockerServiceConfFile = "/etc/systemd/system/cri-docker.service.d/10-cni.conf"
713
723
var CRIDockerServiceConfTemplate = template .Must (template .New ("criDockerServiceConfTemplate" ).Parse (`[Service]
714
724
ExecStart=
715
- ExecStart=/usr/bin/cri-dockerd --container-runtime-endpoint fd:// --network-plugin={{.NetworkPlugin}}{{.ExtraArguments}}` ))
725
+ ExecStart={{.ExecPath}} --container-runtime-endpoint fd:// --network-plugin={{.NetworkPlugin}}{{.ExtraArguments}}` ))
716
726
717
727
b := bytes.Buffer {}
718
728
if err := CRIDockerServiceConfTemplate .Execute (& b , opts ); err != nil {
You can’t perform that action at this time.
0 commit comments