mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Merge pull request #5679 from thockin/fix_windows
Make net plugins build on non-unix
This commit is contained in:
commit
98925b4271
@ -53,7 +53,6 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network"
|
||||||
@ -72,7 +71,6 @@ const (
|
|||||||
setUpCmd = "setup"
|
setUpCmd = "setup"
|
||||||
tearDownCmd = "teardown"
|
tearDownCmd = "teardown"
|
||||||
execDir = "/usr/libexec/kubernetes/kubelet-plugins/net/exec/"
|
execDir = "/usr/libexec/kubernetes/kubelet-plugins/net/exec/"
|
||||||
X_OK = 0x1
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ProbeNetworkPlugins() []network.NetworkPlugin {
|
func ProbeNetworkPlugins() []network.NetworkPlugin {
|
||||||
@ -120,7 +118,7 @@ func (plugin *execNetworkPlugin) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *execNetworkPlugin) validate() error {
|
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)
|
errStr := fmt.Sprintf("Invalid exec plugin. Executable '%s' does not have correct permissions.", plugin.execName)
|
||||||
return errors.New(errStr)
|
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