Skip to content

Commit

Permalink
cnitool: define default NETCONFPATH constant on Windows.
Browse files Browse the repository at this point in the history
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
  • Loading branch information
aznashwan committed Nov 23, 2024
1 parent f813281 commit ef2a217
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cnitool/cnitool.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ const (
EnvCNIArgs = "CNI_ARGS"
EnvCNIIfname = "CNI_IFNAME"

DefaultNetDir = "/etc/cni/net.d"

CmdAdd = "add"
CmdCheck = "check"
CmdDel = "del"
Expand Down
22 changes: 22 additions & 0 deletions cnitool/constants_unix.go
Original file line number Diff line number Diff line change
@@ -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"
)
22 changes: 22 additions & 0 deletions cnitool/constants_windows.go
Original file line number Diff line number Diff line change
@@ -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"
)

0 comments on commit ef2a217

Please sign in to comment.