...

Source file src/k8s.io/kubernetes/pkg/volume/flexvolume/volume.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/mount-utils"
    21  	utilstrings "k8s.io/utils/strings"
    22  
    23  	"k8s.io/apimachinery/pkg/types"
    24  	"k8s.io/kubernetes/pkg/volume"
    25  )
    26  
    27  type flexVolume struct {
    28  	// driverName is the name of the plugin driverName.
    29  	driverName string
    30  	// Driver executable used to setup the volume.
    31  	execPath string
    32  	// mounter provides the interface that is used to mount the actual
    33  	// block device.
    34  	mounter mount.Interface
    35  	// podName is the name of the pod, if available.
    36  	podName string
    37  	// podUID is the UID of the pod.
    38  	podUID types.UID
    39  	// podNamespace is the namespace of the pod, if available.
    40  	podNamespace string
    41  	// podServiceAccountName is the service account name of the pod, if available.
    42  	podServiceAccountName string
    43  	// volName is the name of the pod's volume.
    44  	volName string
    45  	// the underlying plugin
    46  	plugin *flexVolumePlugin
    47  	// the metric plugin
    48  	volume.MetricsProvider
    49  }
    50  
    51  // volume.Volume interface
    52  
    53  func (f *flexVolume) GetPath() string {
    54  	name := f.driverName
    55  	return f.plugin.host.GetPodVolumeDir(f.podUID, utilstrings.EscapeQualifiedName(name), f.volName)
    56  }
    57  

View as plain text