mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Make net plugins build on non-unix
This commit is contained in:
parent
bec527f886
commit
4ee6eb8c73
@ -53,7 +53,6 @@ import (
|
||||
"io/ioutil"
|
||||
"path"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network"
|
||||
@ -72,7 +71,6 @@ const (
|
||||
setUpCmd = "setup"
|
||||
tearDownCmd = "teardown"
|
||||
execDir = "/usr/libexec/kubernetes/kubelet-plugins/net/exec/"
|
||||
X_OK = 0x1
|
||||
)
|
||||
|
||||
func ProbeNetworkPlugins() []network.NetworkPlugin {
|
||||
@ -120,7 +118,7 @@ func (plugin *execNetworkPlugin) Name() string {
|
||||
}
|
||||
|
||||
func (plugin *execNetworkPlugin) validate() error {
|
||||
if syscall.Access(plugin.getExecutable(), X_OK) != nil {
|
||||
if !isExecutable(plugin.getExecutable()) {
|
||||
errStr := fmt.Sprintf("Invalid exec plugin. Executable '%s' does not have correct permissions.", plugin.execName)
|
||||
return errors.New(errStr)
|
||||
}
|
||||
|
27
pkg/kubelet/network/exec/exec_unix.go
Normal file
27
pkg/kubelet/network/exec/exec_unix.go
Normal file
@ -0,0 +1,27 @@
|
||||
// +build !windows
|
||||
|
||||
/*
|
||||
Copyright 2015 Google Inc. All rights reserved.
|
||||
|
||||
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 exec
|
||||
|
||||
import "syscall"
|
||||
|
||||
const X_OK = 0x1
|
||||
|
||||
func isExecutable(path string) bool {
|
||||
return syscall.Access(path, X_OK) == nil
|
||||
}
|
23
pkg/kubelet/network/exec/exec_unsupported.go
Normal file
23
pkg/kubelet/network/exec/exec_unsupported.go
Normal file
@ -0,0 +1,23 @@
|
||||
// +build windows
|
||||
|
||||
/*
|
||||
Copyright 2015 Google Inc. All rights reserved.
|
||||
|
||||
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 exec
|
||||
|
||||
func isExecutable(path string) bool {
|
||||
return false
|
||||
}
|
Loading…
Reference in New Issue
Block a user