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