...

Source file src/k8s.io/kubernetes/pkg/volume/util/hostutil/hostutil_unsupported.go

Documentation: k8s.io/kubernetes/pkg/volume/util/hostutil

     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 hostutil
    21  
    22  import (
    23  	"errors"
    24  	"os"
    25  
    26  	"k8s.io/mount-utils"
    27  )
    28  
    29  // HostUtil is an HostUtils implementation that allows compilation on
    30  // unsupported platforms
    31  type HostUtil struct{}
    32  
    33  // NewHostUtil returns a struct that implements the HostUtils interface on
    34  // unsupported platforms
    35  func NewHostUtil() *HostUtil {
    36  	return &HostUtil{}
    37  }
    38  
    39  var errUnsupported = errors.New("volume/util/hostutil on this platform is not supported")
    40  
    41  // DeviceOpened always returns an error on unsupported platforms
    42  func (hu *HostUtil) DeviceOpened(pathname string) (bool, error) {
    43  	return false, errUnsupported
    44  }
    45  
    46  // PathIsDevice always returns an error on unsupported platforms
    47  func (hu *HostUtil) PathIsDevice(pathname string) (bool, error) {
    48  	return true, errUnsupported
    49  }
    50  
    51  // GetDeviceNameFromMount always returns an error on unsupported platforms
    52  func (hu *HostUtil) GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error) {
    53  	return getDeviceNameFromMount(mounter, mountPath, pluginMountDir)
    54  }
    55  
    56  // MakeRShared always returns an error on unsupported platforms
    57  func (hu *HostUtil) MakeRShared(path string) error {
    58  	return errUnsupported
    59  }
    60  
    61  // GetFileType always returns an error on unsupported platforms
    62  func (hu *HostUtil) GetFileType(pathname string) (FileType, error) {
    63  	return FileType("fake"), errUnsupported
    64  }
    65  
    66  // MakeFile always returns an error on unsupported platforms
    67  func (hu *HostUtil) MakeFile(pathname string) error {
    68  	return errUnsupported
    69  }
    70  
    71  // MakeDir always returns an error on unsupported platforms
    72  func (hu *HostUtil) MakeDir(pathname string) error {
    73  	return errUnsupported
    74  }
    75  
    76  // PathExists always returns an error on unsupported platforms
    77  func (hu *HostUtil) PathExists(pathname string) (bool, error) {
    78  	return true, errUnsupported
    79  }
    80  
    81  // EvalHostSymlinks always returns an error on unsupported platforms
    82  func (hu *HostUtil) EvalHostSymlinks(pathname string) (string, error) {
    83  	return "", errUnsupported
    84  }
    85  
    86  // GetOwner always returns an error on unsupported platforms
    87  func (hu *HostUtil) GetOwner(pathname string) (int64, int64, error) {
    88  	return -1, -1, errUnsupported
    89  }
    90  
    91  // GetSELinuxSupport always returns an error on unsupported platforms
    92  func (hu *HostUtil) GetSELinuxSupport(pathname string) (bool, error) {
    93  	return false, errUnsupported
    94  }
    95  
    96  // GetMode always returns an error on unsupported platforms
    97  func (hu *HostUtil) GetMode(pathname string) (os.FileMode, error) {
    98  	return 0, errUnsupported
    99  }
   100  
   101  func getDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error) {
   102  	return "", errUnsupported
   103  }
   104  
   105  // GetSELinuxMountContext returns value of -o context=XYZ mount option on
   106  // given mount point.
   107  func (hu *HostUtil) GetSELinuxMountContext(pathname string) (string, error) {
   108  	return "", errUnsupported
   109  }
   110  

View as plain text