k8s.io/kubernetes@v1.29.3/pkg/volume/util/subpath/subpath_unsupported.go (about) 1 //go:build !linux && !windows 2 // +build !linux,!windows 3 4 /* 5 Copyright 2014 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 subpath 21 22 import ( 23 "errors" 24 "os" 25 26 "k8s.io/mount-utils" 27 "k8s.io/utils/nsenter" 28 ) 29 30 type subpath struct{} 31 32 var errUnsupported = errors.New("util/subpath on this platform is not supported") 33 34 // New returns a subpath.Interface for the current system. 35 func New(mount.Interface) Interface { 36 return &subpath{} 37 } 38 39 // NewNSEnter is to satisfy the compiler for having NewSubpathNSEnter exist for all 40 // OS choices. however, NSEnter is only valid on Linux 41 func NewNSEnter(mounter mount.Interface, ne *nsenter.Nsenter, rootDir string) Interface { 42 return nil 43 } 44 45 func (sp *subpath) PrepareSafeSubpath(subPath Subpath) (newHostPath string, cleanupAction func(), err error) { 46 return subPath.Path, nil, errUnsupported 47 } 48 49 func (sp *subpath) CleanSubPaths(podDir string, volumeName string) error { 50 return errUnsupported 51 } 52 53 func (sp *subpath) SafeMakeDir(pathname string, base string, perm os.FileMode) error { 54 return errUnsupported 55 }