...

Source file src/k8s.io/kubernetes/pkg/volume/flexvolume/mounter-defaults.go

Documentation: k8s.io/kubernetes/pkg/volume/flexvolume

     1  /*
     2  Copyright 2017 The Kubernetes Authors.
     3  
     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  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package flexvolume
    18  
    19  import (
    20  	"k8s.io/klog/v2"
    21  
    22  	"k8s.io/kubernetes/pkg/volume"
    23  )
    24  
    25  type mounterDefaults flexVolumeMounter
    26  
    27  // SetUpAt is part of the volume.Mounter interface.
    28  // This implementation relies on the attacher's device mount path and does a bind mount to dir.
    29  func (f *mounterDefaults) SetUpAt(dir string, mounterArgs volume.MounterArgs) error {
    30  	klog.Warning(logPrefix(f.plugin), "using default SetUpAt to ", dir)
    31  
    32  	src, err := f.plugin.getDeviceMountPath(f.spec)
    33  	if err != nil {
    34  		return err
    35  	}
    36  
    37  	if err := doMount(f.mounter, src, dir, "auto", []string{"bind"}); err != nil {
    38  		return err
    39  	}
    40  
    41  	return nil
    42  }
    43  
    44  // Returns the default volume attributes.
    45  func (f *mounterDefaults) GetAttributes() volume.Attributes {
    46  	klog.V(5).Info(logPrefix(f.plugin), "using default GetAttributes")
    47  	return volume.Attributes{
    48  		ReadOnly:       f.readOnly,
    49  		Managed:        !f.readOnly,
    50  		SELinuxRelabel: f.flexVolume.plugin.capabilities.SELinuxRelabel,
    51  	}
    52  }
    53  

View as plain text