github.com/kubernetes/utils@v0.0.0-20190308190857-21c4ce38f2a7/nsenter/nsenter_unsupported.go (about) 1 // +build !linux 2 3 /* 4 Copyright 2017 The Kubernetes Authors. 5 6 Licensed under the Apache License, Version 2.0 (the "License"); 7 you may not use this file except in compliance with the License. 8 You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 See the License for the specific language governing permissions and 16 limitations under the License. 17 */ 18 19 package nsenter 20 21 import ( 22 "context" 23 "fmt" 24 25 "k8s.io/utils/exec" 26 ) 27 28 const ( 29 // DefaultHostRootFsPath is path to host's filesystem mounted into container 30 // with kubelet. 31 DefaultHostRootFsPath = "/rootfs" 32 ) 33 34 // Nsenter is a type alias for backward compatibility 35 type Nsenter = NSEnter 36 37 // NSEnter is part of experimental support for running the kubelet 38 // in a container. 39 type NSEnter struct { 40 // a map of commands to their paths on the host filesystem 41 Paths map[string]string 42 } 43 44 // NewNsenter constructs a new instance of NSEnter 45 func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error) { 46 return &Nsenter{}, nil 47 } 48 49 // Exec executes nsenter commands in hostProcMountNsPath mount namespace 50 func (ne *NSEnter) Exec(cmd string, args []string) exec.Cmd { 51 return nil 52 } 53 54 // AbsHostPath returns the absolute runnable path for a specified command 55 func (ne *NSEnter) AbsHostPath(command string) string { 56 return "" 57 } 58 59 // SupportsSystemd checks whether command systemd-run exists 60 func (ne *NSEnter) SupportsSystemd() (string, bool) { 61 return "", false 62 } 63 64 // Command returns a command wrapped with nenter 65 func (ne *NSEnter) Command(cmd string, args ...string) exec.Cmd { 66 return nil 67 } 68 69 // CommandContext returns a CommandContext wrapped with nsenter 70 func (ne *NSEnter) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd { 71 return nil 72 } 73 74 // LookPath returns a LookPath wrapped with nsenter 75 func (ne *NSEnter) LookPath(file string) (string, error) { 76 return "", fmt.Errorf("not implemented, error looking up : %s", file) 77 } 78 79 var _ exec.Interface = &NSEnter{}