diff --git a/cnitool/cnitool.go b/cnitool/cnitool.go index b2685bce..20ffcf12 100644 --- a/cnitool/cnitool.go +++ b/cnitool/cnitool.go @@ -34,8 +34,6 @@ const ( EnvCNIArgs = "CNI_ARGS" EnvCNIIfname = "CNI_IFNAME" - DefaultNetDir = "/etc/cni/net.d" - CmdAdd = "add" CmdCheck = "check" CmdDel = "del" diff --git a/cnitool/constants_unix.go b/cnitool/constants_unix.go new file mode 100644 index 00000000..dda0a500 --- /dev/null +++ b/cnitool/constants_unix.go @@ -0,0 +1,22 @@ +// Copyright 2023 CNI authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris + +package main + +const ( + DefaultNetDir = "/etc/cni/net.d" +) diff --git a/cnitool/constants_windows.go b/cnitool/constants_windows.go new file mode 100644 index 00000000..d14d3e14 --- /dev/null +++ b/cnitool/constants_windows.go @@ -0,0 +1,22 @@ +// Copyright 2023 CNI authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +const ( + // NOTE: this is the most reasonable default as most CNI setups on Windows + // will have been made using the helper script in the containerd repo. + // https://github.com/containerd/containerd/blob/main/script/setup/install-cni-windows + DefaultNetDir = "C:\\Program Files\\containerd\\cni\\conf" +)