nsenter_unsupported.go 2.1 KB

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