subpath_unsupported.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // +build !linux,!windows
  2. /*
  3. Copyright 2014 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 subpath
  15. import (
  16. "errors"
  17. "os"
  18. "k8s.io/kubernetes/pkg/util/mount"
  19. "k8s.io/utils/nsenter"
  20. )
  21. type subpath struct{}
  22. var errUnsupported = errors.New("util/subpath on this platform is not supported")
  23. // New returns a subpath.Interface for the current system.
  24. func New(mount.Interface) Interface {
  25. return &subpath{}
  26. }
  27. // NewNSEnter is to satisfy the compiler for having NewSubpathNSEnter exist for all
  28. // OS choices. however, NSEnter is only valid on Linux
  29. func NewNSEnter(mounter mount.Interface, ne *nsenter.Nsenter, rootDir string) Interface {
  30. return nil
  31. }
  32. func (sp *subpath) PrepareSafeSubpath(subPath Subpath) (newHostPath string, cleanupAction func(), err error) {
  33. return subPath.Path, nil, errUnsupported
  34. }
  35. func (sp *subpath) CleanSubPaths(podDir string, volumeName string) error {
  36. return errUnsupported
  37. }
  38. func (sp *subpath) SafeMakeDir(pathname string, base string, perm os.FileMode) error {
  39. return errUnsupported
  40. }