dependencies: pkg/volume

This commit is contained in:
Chao Xu
2016-11-18 12:58:56 -08:00
parent c962c2602a
commit bb675d395f
73 changed files with 1195 additions and 1194 deletions

View File

@@ -22,7 +22,7 @@ import (
"runtime"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec"
@@ -87,19 +87,19 @@ func (plugin *nfsPlugin) RequiresRemount() bool {
return false
}
func (plugin *nfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce,
api.ReadOnlyMany,
api.ReadWriteMany,
func (plugin *nfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []v1.PersistentVolumeAccessMode{
v1.ReadWriteOnce,
v1.ReadOnlyMany,
v1.ReadWriteMany,
}
}
func (plugin *nfsPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
func (plugin *nfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter())
}
func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *api.Pod, mounter mount.Interface) (volume.Mounter, error) {
func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface) (volume.Mounter, error) {
source, readOnly, err := getVolumeSource(spec)
if err != nil {
return nil, err
@@ -126,7 +126,7 @@ func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID,
return &nfsUnmounter{&nfs{
volName: volName,
mounter: mounter,
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}},
pod: &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: podUID}},
plugin: plugin,
}}, nil
}
@@ -136,10 +136,10 @@ func (plugin *nfsPlugin) NewRecycler(pvName string, spec *volume.Spec, eventReco
}
func (plugin *nfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
nfsVolume := &api.Volume{
nfsVolume := &v1.Volume{
Name: volumeName,
VolumeSource: api.VolumeSource{
NFS: &api.NFSVolumeSource{
VolumeSource: v1.VolumeSource{
NFS: &v1.NFSVolumeSource{
Path: volumeName,
},
},
@@ -150,7 +150,7 @@ func (plugin *nfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*vol
// NFS volumes represent a bare host file or directory mount of an NFS export.
type nfs struct {
volName string
pod *api.Pod
pod *v1.Pod
mounter mount.Interface
plugin *nfsPlugin
volume.MetricsNil
@@ -337,12 +337,12 @@ func (r *nfsRecycler) Recycle() error {
if err != nil {
return err
}
pod := templateClone.(*api.Pod)
pod := templateClone.(*v1.Pod)
// overrides
pod.Spec.ActiveDeadlineSeconds = &r.timeout
pod.GenerateName = "pv-recycler-nfs-"
pod.Spec.Volumes[0].VolumeSource = api.VolumeSource{
NFS: &api.NFSVolumeSource{
pod.Spec.Volumes[0].VolumeSource = v1.VolumeSource{
NFS: &v1.NFSVolumeSource{
Server: r.server,
Path: r.path,
},
@@ -350,7 +350,7 @@ func (r *nfsRecycler) Recycle() error {
return volume.RecycleVolumeByWatchingPodUntilCompletion(r.pvName, pod, r.host.GetKubeClient(), r.eventRecorder)
}
func getVolumeSource(spec *volume.Spec) (*api.NFSVolumeSource, bool, error) {
func getVolumeSource(spec *volume.Spec) (*v1.NFSVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.NFS != nil {
return spec.Volume.NFS, spec.Volume.NFS.ReadOnly, nil
} else if spec.PersistentVolume != nil &&