Commit bb675d39 authored by Chao Xu's avatar Chao Xu

dependencies: pkg/volume

parent c962c260
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"errors" "errors"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
...@@ -191,9 +191,9 @@ func newDetacher(testcase *testcase) *awsElasticBlockStoreDetacher { ...@@ -191,9 +191,9 @@ func newDetacher(testcase *testcase) *awsElasticBlockStoreDetacher {
func createVolSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec { func createVolSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: string(name), VolumeID: string(name),
ReadOnly: readOnly, ReadOnly: readOnly,
}, },
...@@ -204,10 +204,10 @@ func createVolSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec { ...@@ -204,10 +204,10 @@ func createVolSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec {
func createPVSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec { func createPVSpec(name aws.KubernetesVolumeID, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
PersistentVolume: &api.PersistentVolume{ PersistentVolume: &v1.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: string(name), VolumeID: string(name),
ReadOnly: readOnly, ReadOnly: readOnly,
}, },
......
...@@ -25,8 +25,8 @@ import ( ...@@ -25,8 +25,8 @@ import (
"strings" "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
...@@ -85,13 +85,13 @@ func (plugin *awsElasticBlockStorePlugin) RequiresRemount() bool { ...@@ -85,13 +85,13 @@ func (plugin *awsElasticBlockStorePlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
} }
} }
func (plugin *awsElasticBlockStorePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *awsElasticBlockStorePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newMounterInternal(spec, pod.UID, &AWSDiskUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &AWSDiskUtil{}, plugin.host.GetMounter())
} }
...@@ -176,7 +176,7 @@ func (plugin *awsElasticBlockStorePlugin) newProvisionerInternal(options volume. ...@@ -176,7 +176,7 @@ func (plugin *awsElasticBlockStorePlugin) newProvisionerInternal(options volume.
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.AWSElasticBlockStoreVolumeSource, bool, error) { spec *volume.Spec) (*v1.AWSElasticBlockStoreVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.AWSElasticBlockStore != nil { if spec.Volume != nil && spec.Volume.AWSElasticBlockStore != nil {
return spec.Volume.AWSElasticBlockStore, spec.Volume.AWSElasticBlockStore.ReadOnly, nil return spec.Volume.AWSElasticBlockStore, spec.Volume.AWSElasticBlockStore.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
...@@ -220,10 +220,10 @@ func (plugin *awsElasticBlockStorePlugin) ConstructVolumeSpec(volName, mountPath ...@@ -220,10 +220,10 @@ func (plugin *awsElasticBlockStorePlugin) ConstructVolumeSpec(volName, mountPath
glog.V(4).Infof("Convert aws volume name from %q to %q ", volumeID, sourceName) glog.V(4).Infof("Convert aws volume name from %q to %q ", volumeID, sourceName)
} }
awsVolume := &api.Volume{ awsVolume := &v1.Volume{
Name: volName, Name: volName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: sourceName, VolumeID: sourceName,
}, },
}, },
...@@ -444,29 +444,29 @@ type awsElasticBlockStoreProvisioner struct { ...@@ -444,29 +444,29 @@ type awsElasticBlockStoreProvisioner struct {
var _ volume.Provisioner = &awsElasticBlockStoreProvisioner{} var _ volume.Provisioner = &awsElasticBlockStoreProvisioner{}
func (c *awsElasticBlockStoreProvisioner) Provision() (*api.PersistentVolume, error) { func (c *awsElasticBlockStoreProvisioner) Provision() (*v1.PersistentVolume, error) {
volumeID, sizeGB, labels, err := c.manager.CreateVolume(c) volumeID, sizeGB, labels, err := c.manager.CreateVolume(c)
if err != nil { if err != nil {
glog.Errorf("Provision failed: %v", err) glog.Errorf("Provision failed: %v", err)
return nil, err return nil, err
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: c.options.PVName, Name: c.options.PVName,
Labels: map[string]string{}, Labels: map[string]string{},
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "aws-ebs-dynamic-provisioner", "kubernetes.io/createdby": "aws-ebs-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy,
AccessModes: c.options.PVC.Spec.AccessModes, AccessModes: c.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: string(volumeID), VolumeID: string(volumeID),
FSType: "ext4", FSType: "ext4",
Partition: 0, Partition: 0,
......
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
"path" "path"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -48,10 +48,10 @@ func TestCanSupport(t *testing.T) { ...@@ -48,10 +48,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/aws-ebs" { if plug.GetPluginName() != "kubernetes.io/aws-ebs" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -70,15 +70,15 @@ func TestGetAccessModes(t *testing.T) { ...@@ -70,15 +70,15 @@ func TestGetAccessModes(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) {
t.Errorf("Expected to support AccessModeTypes: %s", api.ReadWriteOnce) t.Errorf("Expected to support AccessModeTypes: %s", v1.ReadWriteOnce)
} }
if contains(plug.GetAccessModes(), api.ReadOnlyMany) { if contains(plug.GetAccessModes(), v1.ReadOnlyMany) {
t.Errorf("Expected not to support AccessModeTypes: %s", api.ReadOnlyMany) t.Errorf("Expected not to support AccessModeTypes: %s", v1.ReadOnlyMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -118,10 +118,10 @@ func TestPlugin(t *testing.T) { ...@@ -118,10 +118,10 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: "pd", VolumeID: "pd",
FSType: "ext4", FSType: "ext4",
}, },
...@@ -181,8 +181,8 @@ func TestPlugin(t *testing.T) { ...@@ -181,8 +181,8 @@ func TestPlugin(t *testing.T) {
// Test Provisioner // Test Provisioner
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: volumetest.CreateTestPVC("100Mi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}), PVC: volumetest.CreateTestPVC("100Mi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
provisioner, err := plug.(*awsElasticBlockStorePlugin).newProvisionerInternal(options, &fakePDManager{}) provisioner, err := plug.(*awsElasticBlockStorePlugin).newProvisionerInternal(options, &fakePDManager{})
persistentSpec, err := provisioner.Provision() persistentSpec, err := provisioner.Provision()
...@@ -193,7 +193,7 @@ func TestPlugin(t *testing.T) { ...@@ -193,7 +193,7 @@ func TestPlugin(t *testing.T) {
if persistentSpec.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID != "test-aws-volume-name" { if persistentSpec.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID != "test-aws-volume-name" {
t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID) t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID)
} }
cap := persistentSpec.Spec.Capacity[api.ResourceStorage] cap := persistentSpec.Spec.Capacity[v1.ResourceStorage]
size := cap.Value() size := cap.Value()
if size != 100*1024*1024*1024 { if size != 100*1024*1024*1024 {
t.Errorf("Provision() returned unexpected volume size: %v", size) t.Errorf("Provision() returned unexpected volume size: %v", size)
...@@ -215,30 +215,30 @@ func TestPlugin(t *testing.T) { ...@@ -215,30 +215,30 @@ func TestPlugin(t *testing.T) {
} }
func TestPersistentClaimReadOnlyFlag(t *testing.T) { func TestPersistentClaimReadOnlyFlag(t *testing.T) {
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}, AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -255,7 +255,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -255,7 +255,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
...@@ -276,10 +276,10 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) { ...@@ -276,10 +276,10 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{ AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
VolumeID: "pd", VolumeID: "pd",
FSType: "ext4", FSType: "ext4",
}, },
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
...@@ -80,7 +80,7 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner) (aws.K ...@@ -80,7 +80,7 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner) (aws.K
} }
tags["Name"] = volume.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 255) // AWS tags can have 255 characters tags["Name"] = volume.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 255) // AWS tags can have 255 characters
capacity := c.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
requestBytes := capacity.Value() requestBytes := capacity.Value()
// AWS works with gigabytes, convert to GiB with rounding up // AWS works with gigabytes, convert to GiB with rounding up
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024)) requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/azure" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
...@@ -102,13 +102,13 @@ func (plugin *azureDataDiskPlugin) RequiresRemount() bool { ...@@ -102,13 +102,13 @@ func (plugin *azureDataDiskPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *azureDataDiskPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *azureDataDiskPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
} }
} }
func (plugin *azureDataDiskPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *azureDataDiskPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod.UID, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, plugin.host.GetMounter())
} }
...@@ -123,7 +123,7 @@ func (plugin *azureDataDiskPlugin) newMounterInternal(spec *volume.Spec, podUID ...@@ -123,7 +123,7 @@ func (plugin *azureDataDiskPlugin) newMounterInternal(spec *volume.Spec, podUID
if azure.FSType != nil { if azure.FSType != nil {
fsType = *azure.FSType fsType = *azure.FSType
} }
cachingMode := api.AzureDataDiskCachingNone cachingMode := v1.AzureDataDiskCachingNone
if azure.CachingMode != nil { if azure.CachingMode != nil {
cachingMode = *azure.CachingMode cachingMode = *azure.CachingMode
} }
...@@ -170,10 +170,10 @@ func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volName, mountPath string ...@@ -170,10 +170,10 @@ func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volName, mountPath string
if err != nil { if err != nil {
return nil, err return nil, err
} }
azVolume := &api.Volume{ azVolume := &v1.Volume{
Name: volName, Name: volName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AzureDisk: &api.AzureDiskVolumeSource{ AzureDisk: &v1.AzureDiskVolumeSource{
DiskName: sourceName, DiskName: sourceName,
}, },
}, },
...@@ -191,7 +191,7 @@ type azureDisk struct { ...@@ -191,7 +191,7 @@ type azureDisk struct {
podUID types.UID podUID types.UID
diskName string diskName string
diskUri string diskUri string
cachingMode api.AzureDataDiskCachingMode cachingMode v1.AzureDataDiskCachingMode
mounter mount.Interface mounter mount.Interface
plugin *azureDataDiskPlugin plugin *azureDataDiskPlugin
volume.MetricsNil volume.MetricsNil
...@@ -359,7 +359,7 @@ func (c *azureDiskUnmounter) TearDownAt(dir string) error { ...@@ -359,7 +359,7 @@ func (c *azureDiskUnmounter) TearDownAt(dir string) error {
return nil return nil
} }
func getVolumeSource(spec *volume.Spec) (*api.AzureDiskVolumeSource, error) { func getVolumeSource(spec *volume.Spec) (*v1.AzureDiskVolumeSource, error) {
if spec.Volume != nil && spec.Volume.AzureDisk != nil { if spec.Volume != nil && spec.Volume.AzureDisk != nil {
return spec.Volume.AzureDisk, nil return spec.Volume.AzureDisk, nil
} }
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -48,11 +48,11 @@ func TestCanSupport(t *testing.T) { ...@@ -48,11 +48,11 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != azureDataDiskPluginName { if plug.GetPluginName() != azureDataDiskPluginName {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{AzureDisk: &api.AzureDiskVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{AzureDisk: &v1.AzureDiskVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{AzureDisk: &api.AzureDiskVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{AzureDisk: &v1.AzureDiskVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -114,11 +114,11 @@ func TestPlugin(t *testing.T) { ...@@ -114,11 +114,11 @@ func TestPlugin(t *testing.T) {
} }
fs := "ext4" fs := "ext4"
ro := false ro := false
caching := api.AzureDataDiskCachingNone caching := v1.AzureDataDiskCachingNone
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AzureDisk: &api.AzureDiskVolumeSource{ AzureDisk: &v1.AzureDiskVolumeSource{
DiskName: fakeDiskName, DiskName: fakeDiskName,
DataDiskURI: fakeDiskUri, DataDiskURI: fakeDiskUri,
FSType: &fs, FSType: &fs,
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"strings" "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
utilstrings "k8s.io/kubernetes/pkg/util/strings" utilstrings "k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
) )
...@@ -104,11 +104,11 @@ type azureDiskProvisioner struct { ...@@ -104,11 +104,11 @@ type azureDiskProvisioner struct {
var _ volume.Provisioner = &azureDiskProvisioner{} var _ volume.Provisioner = &azureDiskProvisioner{}
func (a *azureDiskProvisioner) Provision() (*api.PersistentVolume, error) { func (a *azureDiskProvisioner) Provision() (*v1.PersistentVolume, error) {
var sku, location, account string var sku, location, account string
name := volume.GenerateVolumeName(a.options.ClusterName, a.options.PVName, 255) name := volume.GenerateVolumeName(a.options.ClusterName, a.options.PVName, 255)
capacity := a.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := a.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
requestBytes := capacity.Value() requestBytes := capacity.Value()
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024)) requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
...@@ -136,22 +136,22 @@ func (a *azureDiskProvisioner) Provision() (*api.PersistentVolume, error) { ...@@ -136,22 +136,22 @@ func (a *azureDiskProvisioner) Provision() (*api.PersistentVolume, error) {
return nil, err return nil, err
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: a.options.PVName, Name: a.options.PVName,
Labels: map[string]string{}, Labels: map[string]string{},
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "azure-disk-dynamic-provisioner", "kubernetes.io/createdby": "azure-disk-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: a.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: a.options.PersistentVolumeReclaimPolicy,
AccessModes: a.options.PVC.Spec.AccessModes, AccessModes: a.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
AzureDisk: &api.AzureDiskVolumeSource{ AzureDisk: &v1.AzureDiskVolumeSource{
DiskName: diskName, DiskName: diskName,
DataDiskURI: diskUri, DataDiskURI: diskUri,
}, },
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"os" "os"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
kstrings "k8s.io/kubernetes/pkg/util/strings" kstrings "k8s.io/kubernetes/pkg/util/strings"
...@@ -77,19 +77,19 @@ func (plugin *azureFilePlugin) RequiresRemount() bool { ...@@ -77,19 +77,19 @@ func (plugin *azureFilePlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *azureFilePlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *azureFilePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
api.ReadWriteMany, v1.ReadWriteMany,
} }
} }
func (plugin *azureFilePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *azureFilePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod, &azureSvc{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod, &azureSvc{}, plugin.host.GetMounter())
} }
func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *api.Pod, util azureUtil, mounter mount.Interface) (volume.Mounter, error) { func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, util azureUtil, mounter mount.Interface) (volume.Mounter, error) {
source, readOnly, err := getVolumeSource(spec) source, readOnly, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -118,17 +118,17 @@ func (plugin *azureFilePlugin) newUnmounterInternal(volName string, podUID types ...@@ -118,17 +118,17 @@ func (plugin *azureFilePlugin) newUnmounterInternal(volName string, podUID types
return &azureFileUnmounter{&azureFile{ return &azureFileUnmounter{&azureFile{
volName: volName, volName: volName,
mounter: mounter, mounter: mounter,
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}}, pod: &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: podUID}},
plugin: plugin, plugin: plugin,
MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)), MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)),
}}, nil }}, nil
} }
func (plugin *azureFilePlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) { func (plugin *azureFilePlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) {
azureVolume := &api.Volume{ azureVolume := &v1.Volume{
Name: volName, Name: volName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AzureFile: &api.AzureFileVolumeSource{ AzureFile: &v1.AzureFileVolumeSource{
SecretName: volName, SecretName: volName,
ShareName: volName, ShareName: volName,
}, },
...@@ -140,7 +140,7 @@ func (plugin *azureFilePlugin) ConstructVolumeSpec(volName, mountPath string) (* ...@@ -140,7 +140,7 @@ func (plugin *azureFilePlugin) ConstructVolumeSpec(volName, mountPath string) (*
// azureFile volumes represent mount of an AzureFile share. // azureFile volumes represent mount of an AzureFile share.
type azureFile struct { type azureFile struct {
volName string volName string
pod *api.Pod pod *v1.Pod
mounter mount.Interface mounter mount.Interface
plugin *azureFilePlugin plugin *azureFilePlugin
volume.MetricsProvider volume.MetricsProvider
...@@ -268,7 +268,7 @@ func (c *azureFileUnmounter) TearDownAt(dir string) error { ...@@ -268,7 +268,7 @@ func (c *azureFileUnmounter) TearDownAt(dir string) error {
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.AzureFileVolumeSource, bool, error) { spec *volume.Spec) (*v1.AzureFileVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.AzureFile != nil { if spec.Volume != nil && spec.Volume.AzureFile != nil {
return spec.Volume.AzureFile, spec.Volume.AzureFile.ReadOnly, nil return spec.Volume.AzureFile, spec.Volume.AzureFile.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
"path" "path"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
...@@ -46,10 +46,10 @@ func TestCanSupport(t *testing.T) { ...@@ -46,10 +46,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/azure-file" { if plug.GetPluginName() != "kubernetes.io/azure-file" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{AzureFile: &api.AzureFileVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{AzureFile: &v1.AzureFileVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{AzureFile: &api.AzureFileVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{AzureFile: &v1.AzureFileVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -67,12 +67,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -67,12 +67,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) || !contains(plug.GetAccessModes(), api.ReadWriteMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) || !contains(plug.GetAccessModes(), v1.ReadWriteMany) {
t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany) t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", v1.ReadWriteOnce, v1.ReadOnlyMany, v1.ReadWriteMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -94,17 +94,17 @@ func TestPlugin(t *testing.T) { ...@@ -94,17 +94,17 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AzureFile: &api.AzureFileVolumeSource{ AzureFile: &v1.AzureFileVolumeSource{
SecretName: "secret", SecretName: "secret",
ShareName: "share", ShareName: "share",
}, },
}, },
} }
fake := &mount.FakeMounter{} fake := &mount.FakeMounter{}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.(*azureFilePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), pod, &fakeAzureSvc{}, fake) mounter, err := plug.(*azureFilePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), pod, &fakeAzureSvc{}, fake)
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -155,30 +155,30 @@ func TestPlugin(t *testing.T) { ...@@ -155,30 +155,30 @@ func TestPlugin(t *testing.T) {
} }
func TestPersistentClaimReadOnlyFlag(t *testing.T) { func TestPersistentClaimReadOnlyFlag(t *testing.T) {
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
AzureFile: &api.AzureFileVolumeSource{}, AzureFile: &v1.AzureFileVolumeSource{},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -190,7 +190,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -190,7 +190,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
...@@ -217,17 +217,17 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) { ...@@ -217,17 +217,17 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
AzureFile: &api.AzureFileVolumeSource{ AzureFile: &v1.AzureFileVolumeSource{
SecretName: "secret", SecretName: "secret",
ShareName: "share", ShareName: "share",
}, },
}, },
} }
fake := &mount.FakeMounter{} fake := &mount.FakeMounter{}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.(*azureFilePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), pod, &fakeAzureSvc{}, fake) mounter, err := plug.(*azureFilePlugin).newMounterInternal(volume.NewSpecFromVolume(spec), pod, &fakeAzureSvc{}, fake)
if _, ok := mounter.(volume.Unmounter); ok { if _, ok := mounter.(volume.Unmounter); ok {
t.Errorf("Volume Mounter can be type-assert to Unmounter") t.Errorf("Volume Mounter can be type-assert to Unmounter")
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"strings" "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utilstrings "k8s.io/kubernetes/pkg/util/strings" utilstrings "k8s.io/kubernetes/pkg/util/strings"
...@@ -70,15 +70,15 @@ func (plugin *cephfsPlugin) RequiresRemount() bool { ...@@ -70,15 +70,15 @@ func (plugin *cephfsPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *cephfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *cephfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
api.ReadWriteMany, v1.ReadWriteMany,
} }
} }
func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
cephvs, _, err := getVolumeSource(spec) cephvs, _, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -155,10 +155,10 @@ func (plugin *cephfsPlugin) newUnmounterInternal(volName string, podUID types.UI ...@@ -155,10 +155,10 @@ func (plugin *cephfsPlugin) newUnmounterInternal(volName string, podUID types.UI
} }
func (plugin *cephfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *cephfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
cephfsVolume := &api.Volume{ cephfsVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
CephFS: &api.CephFSVolumeSource{ CephFS: &v1.CephFSVolumeSource{
Monitors: []string{}, Monitors: []string{},
Path: volumeName, Path: volumeName,
}, },
...@@ -312,7 +312,7 @@ func (cephfsVolume *cephfs) execMount(mountpoint string) error { ...@@ -312,7 +312,7 @@ func (cephfsVolume *cephfs) execMount(mountpoint string) error {
return nil return nil
} }
func getVolumeSource(spec *volume.Spec) (*api.CephFSVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.CephFSVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.CephFS != nil { if spec.Volume != nil && spec.Volume.CephFS != nil {
return spec.Volume.CephFS, spec.Volume.CephFS.ReadOnly, nil return spec.Volume.CephFS, spec.Volume.CephFS.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
"path" "path"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -44,10 +44,10 @@ func TestCanSupport(t *testing.T) { ...@@ -44,10 +44,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/cephfs" { if plug.GetPluginName() != "kubernetes.io/cephfs" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{CephFS: &api.CephFSVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{CephFS: &v1.CephFSVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -64,10 +64,10 @@ func TestPlugin(t *testing.T) { ...@@ -64,10 +64,10 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
CephFS: &api.CephFSVolumeSource{ CephFS: &v1.CephFSVolumeSource{
Monitors: []string{"a", "b"}, Monitors: []string{"a", "b"},
User: "user", User: "user",
SecretRef: nil, SecretRef: nil,
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"errors" "errors"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
...@@ -241,9 +241,9 @@ func newDetacher(testcase *testcase) *cinderDiskDetacher { ...@@ -241,9 +241,9 @@ func newDetacher(testcase *testcase) *cinderDiskDetacher {
func createVolSpec(name string, readOnly bool) *volume.Spec { func createVolSpec(name string, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Cinder: &api.CinderVolumeSource{ Cinder: &v1.CinderVolumeSource{
VolumeID: name, VolumeID: name,
ReadOnly: readOnly, ReadOnly: readOnly,
}, },
...@@ -254,10 +254,10 @@ func createVolSpec(name string, readOnly bool) *volume.Spec { ...@@ -254,10 +254,10 @@ func createVolSpec(name string, readOnly bool) *volume.Spec {
func createPVSpec(name string, readOnly bool) *volume.Spec { func createPVSpec(name string, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
PersistentVolume: &api.PersistentVolume{ PersistentVolume: &v1.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Cinder: &api.CinderVolumeSource{ Cinder: &v1.CinderVolumeSource{
VolumeID: name, VolumeID: name,
ReadOnly: readOnly, ReadOnly: readOnly,
}, },
...@@ -430,8 +430,8 @@ type instances struct { ...@@ -430,8 +430,8 @@ type instances struct {
instanceID string instanceID string
} }
func (instances *instances) NodeAddresses(name types.NodeName) ([]api.NodeAddress, error) { func (instances *instances) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error) {
return []api.NodeAddress{}, errors.New("Not implemented") return []v1.NodeAddress{}, errors.New("Not implemented")
} }
func (instances *instances) ExternalID(name types.NodeName) (string, error) { func (instances *instances) ExternalID(name types.NodeName) (string, error) {
......
...@@ -23,8 +23,8 @@ import ( ...@@ -23,8 +23,8 @@ import (
"path" "path"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/openstack" "k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"
"k8s.io/kubernetes/pkg/cloudprovider/providers/rackspace" "k8s.io/kubernetes/pkg/cloudprovider/providers/rackspace"
...@@ -97,13 +97,13 @@ func (plugin *cinderPlugin) RequiresRemount() bool { ...@@ -97,13 +97,13 @@ func (plugin *cinderPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *cinderPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *cinderPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
} }
} }
func (plugin *cinderPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *cinderPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod.UID, &CinderDiskUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &CinderDiskUtil{}, plugin.host.GetMounter())
} }
...@@ -211,10 +211,10 @@ func (plugin *cinderPlugin) ConstructVolumeSpec(volumeName, mountPath string) (* ...@@ -211,10 +211,10 @@ func (plugin *cinderPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*
return nil, err return nil, err
} }
glog.V(4).Infof("Found volume %s mounted to %s", sourceName, mountPath) glog.V(4).Infof("Found volume %s mounted to %s", sourceName, mountPath)
cinderVolume := &api.Volume{ cinderVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Cinder: &api.CinderVolumeSource{ Cinder: &v1.CinderVolumeSource{
VolumeID: sourceName, VolumeID: sourceName,
}, },
}, },
...@@ -464,28 +464,28 @@ type cinderVolumeProvisioner struct { ...@@ -464,28 +464,28 @@ type cinderVolumeProvisioner struct {
var _ volume.Provisioner = &cinderVolumeProvisioner{} var _ volume.Provisioner = &cinderVolumeProvisioner{}
func (c *cinderVolumeProvisioner) Provision() (*api.PersistentVolume, error) { func (c *cinderVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
volumeID, sizeGB, err := c.manager.CreateVolume(c) volumeID, sizeGB, err := c.manager.CreateVolume(c)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: c.options.PVName, Name: c.options.PVName,
Labels: map[string]string{}, Labels: map[string]string{},
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "cinder-dynamic-provisioner", "kubernetes.io/createdby": "cinder-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy,
AccessModes: c.options.PVC.Spec.AccessModes, AccessModes: c.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Cinder: &api.CinderVolumeSource{ Cinder: &v1.CinderVolumeSource{
VolumeID: volumeID, VolumeID: volumeID,
FSType: "ext4", FSType: "ext4",
ReadOnly: false, ReadOnly: false,
...@@ -500,7 +500,7 @@ func (c *cinderVolumeProvisioner) Provision() (*api.PersistentVolume, error) { ...@@ -500,7 +500,7 @@ func (c *cinderVolumeProvisioner) Provision() (*api.PersistentVolume, error) {
return pv, nil return pv, nil
} }
func getVolumeSource(spec *volume.Spec) (*api.CinderVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.CinderVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.Cinder != nil { if spec.Volume != nil && spec.Volume.Cinder != nil {
return spec.Volume.Cinder, spec.Volume.Cinder.ReadOnly, nil return spec.Volume.Cinder, spec.Volume.Cinder.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"testing" "testing"
"time" "time"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -47,11 +47,11 @@ func TestCanSupport(t *testing.T) { ...@@ -47,11 +47,11 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/cinder" { if plug.GetPluginName() != "kubernetes.io/cinder" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{Cinder: &api.CinderVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{Cinder: &v1.CinderVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{Cinder: &api.CinderVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{Cinder: &v1.CinderVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -140,10 +140,10 @@ func TestPlugin(t *testing.T) { ...@@ -140,10 +140,10 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Cinder: &api.CinderVolumeSource{ Cinder: &v1.CinderVolumeSource{
VolumeID: "pd", VolumeID: "pd",
FSType: "ext4", FSType: "ext4",
}, },
...@@ -199,8 +199,8 @@ func TestPlugin(t *testing.T) { ...@@ -199,8 +199,8 @@ func TestPlugin(t *testing.T) {
// Test Provisioner // Test Provisioner
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: volumetest.CreateTestPVC("100Mi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}), PVC: volumetest.CreateTestPVC("100Mi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
provisioner, err := plug.(*cinderPlugin).newProvisionerInternal(options, &fakePDManager{0}) provisioner, err := plug.(*cinderPlugin).newProvisionerInternal(options, &fakePDManager{0})
persistentSpec, err := provisioner.Provision() persistentSpec, err := provisioner.Provision()
...@@ -211,7 +211,7 @@ func TestPlugin(t *testing.T) { ...@@ -211,7 +211,7 @@ func TestPlugin(t *testing.T) {
if persistentSpec.Spec.PersistentVolumeSource.Cinder.VolumeID != "test-volume-name" { if persistentSpec.Spec.PersistentVolumeSource.Cinder.VolumeID != "test-volume-name" {
t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.Cinder.VolumeID) t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.Cinder.VolumeID)
} }
cap := persistentSpec.Spec.Capacity[api.ResourceStorage] cap := persistentSpec.Spec.Capacity[v1.ResourceStorage]
size := cap.Value() size := cap.Value()
if size != 1024*1024*1024 { if size != 1024*1024*1024 {
t.Errorf("Provision() returned unexpected volume size: %v", size) t.Errorf("Provision() returned unexpected volume size: %v", size)
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
) )
...@@ -140,7 +140,7 @@ func (util *CinderDiskUtil) CreateVolume(c *cinderVolumeProvisioner) (volumeID s ...@@ -140,7 +140,7 @@ func (util *CinderDiskUtil) CreateVolume(c *cinderVolumeProvisioner) (volumeID s
return "", 0, err return "", 0, err
} }
capacity := c.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
volSizeBytes := capacity.Value() volSizeBytes := capacity.Value()
// Cinder works with gigabytes, convert to GiB with rounding up // Cinder works with gigabytes, convert to GiB with rounding up
volSizeGB := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024)) volSizeGB := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
ioutil "k8s.io/kubernetes/pkg/util/io" ioutil "k8s.io/kubernetes/pkg/util/io"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -74,7 +74,7 @@ func (plugin *configMapPlugin) RequiresRemount() bool { ...@@ -74,7 +74,7 @@ func (plugin *configMapPlugin) RequiresRemount() bool {
return true return true
} }
func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {
return &configMapVolumeMounter{ return &configMapVolumeMounter{
configMapVolume: &configMapVolume{spec.Name(), pod.UID, plugin, plugin.host.GetMounter(), plugin.host.GetWriter(), volume.MetricsNil{}}, configMapVolume: &configMapVolume{spec.Name(), pod.UID, plugin, plugin.host.GetMounter(), plugin.host.GetWriter(), volume.MetricsNil{}},
source: *spec.Volume.ConfigMap, source: *spec.Volume.ConfigMap,
...@@ -87,10 +87,10 @@ func (plugin *configMapPlugin) NewUnmounter(volName string, podUID types.UID) (v ...@@ -87,10 +87,10 @@ func (plugin *configMapPlugin) NewUnmounter(volName string, podUID types.UID) (v
} }
func (plugin *configMapPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *configMapPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
configMapVolume := &api.Volume{ configMapVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
ConfigMap: &api.ConfigMapVolumeSource{}, ConfigMap: &v1.ConfigMapVolumeSource{},
}, },
} }
return volume.NewSpecFromVolume(configMapVolume), nil return volume.NewSpecFromVolume(configMapVolume), nil
...@@ -116,8 +116,8 @@ func (sv *configMapVolume) GetPath() string { ...@@ -116,8 +116,8 @@ func (sv *configMapVolume) GetPath() string {
type configMapVolumeMounter struct { type configMapVolumeMounter struct {
*configMapVolume *configMapVolume
source api.ConfigMapVolumeSource source v1.ConfigMapVolumeSource
pod api.Pod pod v1.Pod
opts *volume.VolumeOptions opts *volume.VolumeOptions
} }
...@@ -137,7 +137,7 @@ func wrappedVolumeSpec() volume.Spec { ...@@ -137,7 +137,7 @@ func wrappedVolumeSpec() volume.Spec {
// This should be on a tmpfs instead of the local disk; the problem is // This should be on a tmpfs instead of the local disk; the problem is
// charging the memory for the tmpfs to the right cgroup. We should make // charging the memory for the tmpfs to the right cgroup. We should make
// this a tmpfs when we can do the accounting correctly. // this a tmpfs when we can do the accounting correctly.
Volume: &api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, Volume: &v1.Volume{VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}},
} }
} }
...@@ -209,7 +209,7 @@ func (b *configMapVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { ...@@ -209,7 +209,7 @@ func (b *configMapVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
return nil return nil
} }
func makePayload(mappings []api.KeyToPath, configMap *api.ConfigMap, defaultMode *int32) (map[string]volumeutil.FileProjection, error) { func makePayload(mappings []v1.KeyToPath, configMap *v1.ConfigMap, defaultMode *int32) (map[string]volumeutil.FileProjection, error) {
if defaultMode == nil { if defaultMode == nil {
return nil, fmt.Errorf("No defaultMode used, not even the default value for it") return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
} }
...@@ -245,7 +245,7 @@ func makePayload(mappings []api.KeyToPath, configMap *api.ConfigMap, defaultMode ...@@ -245,7 +245,7 @@ func makePayload(mappings []api.KeyToPath, configMap *api.ConfigMap, defaultMode
return payload, nil return payload, nil
} }
func totalBytes(configMap *api.ConfigMap) int { func totalBytes(configMap *v1.ConfigMap) int {
totalSize := 0 totalSize := 0
for _, value := range configMap.Data { for _, value := range configMap.Data {
totalSize += len(value) totalSize += len(value)
...@@ -276,9 +276,9 @@ func (c *configMapVolumeUnmounter) TearDownAt(dir string) error { ...@@ -276,9 +276,9 @@ func (c *configMapVolumeUnmounter) TearDownAt(dir string) error {
return wrapped.TearDownAt(dir) return wrapped.TearDownAt(dir)
} }
func getVolumeSource(spec *volume.Spec) (*api.ConfigMapVolumeSource, bool) { func getVolumeSource(spec *volume.Spec) (*v1.ConfigMapVolumeSource, bool) {
var readOnly bool var readOnly bool
var volumeSource *api.ConfigMapVolumeSource var volumeSource *v1.ConfigMapVolumeSource
if spec.Volume != nil && spec.Volume.ConfigMap != nil { if spec.Volume != nil && spec.Volume.ConfigMap != nil {
volumeSource = spec.Volume.ConfigMap volumeSource = spec.Volume.ConfigMap
......
...@@ -25,9 +25,9 @@ import ( ...@@ -25,9 +25,9 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir" "k8s.io/kubernetes/pkg/volume/empty_dir"
...@@ -39,15 +39,15 @@ func TestMakePayload(t *testing.T) { ...@@ -39,15 +39,15 @@ func TestMakePayload(t *testing.T) {
caseMappingMode := int32(0400) caseMappingMode := int32(0400)
cases := []struct { cases := []struct {
name string name string
mappings []api.KeyToPath mappings []v1.KeyToPath
configMap *api.ConfigMap configMap *v1.ConfigMap
mode int32 mode int32
payload map[string]util.FileProjection payload map[string]util.FileProjection
success bool success bool
}{ }{
{ {
name: "no overrides", name: "no overrides",
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -62,13 +62,13 @@ func TestMakePayload(t *testing.T) { ...@@ -62,13 +62,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "basic 1", name: "basic 1",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/foo.txt", Path: "path/to/foo.txt",
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -82,13 +82,13 @@ func TestMakePayload(t *testing.T) { ...@@ -82,13 +82,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "subdirs", name: "subdirs",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/1/2/3/foo.txt", Path: "path/to/1/2/3/foo.txt",
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -102,13 +102,13 @@ func TestMakePayload(t *testing.T) { ...@@ -102,13 +102,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "subdirs 2", name: "subdirs 2",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/1/2/3/foo.txt", Path: "path/to/1/2/3/foo.txt",
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -122,7 +122,7 @@ func TestMakePayload(t *testing.T) { ...@@ -122,7 +122,7 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "subdirs 3", name: "subdirs 3",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/1/2/3/foo.txt", Path: "path/to/1/2/3/foo.txt",
...@@ -132,7 +132,7 @@ func TestMakePayload(t *testing.T) { ...@@ -132,7 +132,7 @@ func TestMakePayload(t *testing.T) {
Path: "another/path/to/the/esteemed/bar.bin", Path: "another/path/to/the/esteemed/bar.bin",
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -147,13 +147,13 @@ func TestMakePayload(t *testing.T) { ...@@ -147,13 +147,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "non existent key", name: "non existent key",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "zab", Key: "zab",
Path: "path/to/foo.txt", Path: "path/to/foo.txt",
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -164,7 +164,7 @@ func TestMakePayload(t *testing.T) { ...@@ -164,7 +164,7 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "mapping with Mode", name: "mapping with Mode",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "foo.txt", Path: "foo.txt",
...@@ -176,7 +176,7 @@ func TestMakePayload(t *testing.T) { ...@@ -176,7 +176,7 @@ func TestMakePayload(t *testing.T) {
Mode: &caseMappingMode, Mode: &caseMappingMode,
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -191,7 +191,7 @@ func TestMakePayload(t *testing.T) { ...@@ -191,7 +191,7 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "mapping with defaultMode", name: "mapping with defaultMode",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "foo.txt", Path: "foo.txt",
...@@ -201,7 +201,7 @@ func TestMakePayload(t *testing.T) { ...@@ -201,7 +201,7 @@ func TestMakePayload(t *testing.T) {
Path: "bar.bin", Path: "bar.bin",
}, },
}, },
configMap: &api.ConfigMap{ configMap: &v1.ConfigMap{
Data: map[string]string{ Data: map[string]string{
"foo": "foo", "foo": "foo",
"bar": "bar", "bar": "bar",
...@@ -260,7 +260,7 @@ func TestCanSupport(t *testing.T) { ...@@ -260,7 +260,7 @@ func TestCanSupport(t *testing.T) {
if plugin.GetPluginName() != configMapPluginName { if plugin.GetPluginName() != configMapPluginName {
t.Errorf("Wrong name: %s", plugin.GetPluginName()) t.Errorf("Wrong name: %s", plugin.GetPluginName())
} }
if !plugin.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{ConfigMap: &api.ConfigMapVolumeSource{LocalObjectReference: api.LocalObjectReference{Name: ""}}}}}) { if !plugin.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{ConfigMap: &v1.ConfigMapVolumeSource{LocalObjectReference: v1.LocalObjectReference{Name: ""}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if plugin.CanSupport(&volume.Spec{}) { if plugin.CanSupport(&volume.Spec{}) {
...@@ -290,7 +290,7 @@ func TestPlugin(t *testing.T) { ...@@ -290,7 +290,7 @@ func TestPlugin(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -354,7 +354,7 @@ func TestPluginReboot(t *testing.T) { ...@@ -354,7 +354,7 @@ func TestPluginReboot(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -387,12 +387,12 @@ func TestPluginReboot(t *testing.T) { ...@@ -387,12 +387,12 @@ func TestPluginReboot(t *testing.T) {
doTestCleanAndTeardown(plugin, testPodUID, testVolumeName, volumePath, t) doTestCleanAndTeardown(plugin, testPodUID, testVolumeName, volumePath, t)
} }
func volumeSpec(volumeName, configMapName string, defaultMode int32) *api.Volume { func volumeSpec(volumeName, configMapName string, defaultMode int32) *v1.Volume {
return &api.Volume{ return &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
ConfigMap: &api.ConfigMapVolumeSource{ ConfigMap: &v1.ConfigMapVolumeSource{
LocalObjectReference: api.LocalObjectReference{ LocalObjectReference: v1.LocalObjectReference{
Name: configMapName, Name: configMapName,
}, },
DefaultMode: &defaultMode, DefaultMode: &defaultMode,
...@@ -401,9 +401,9 @@ func volumeSpec(volumeName, configMapName string, defaultMode int32) *api.Volume ...@@ -401,9 +401,9 @@ func volumeSpec(volumeName, configMapName string, defaultMode int32) *api.Volume
} }
} }
func configMap(namespace, name string) api.ConfigMap { func configMap(namespace, name string) v1.ConfigMap {
return api.ConfigMap{ return v1.ConfigMap{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Namespace: namespace, Namespace: namespace,
Name: name, Name: name,
}, },
...@@ -415,7 +415,7 @@ func configMap(namespace, name string) api.ConfigMap { ...@@ -415,7 +415,7 @@ func configMap(namespace, name string) api.ConfigMap {
} }
} }
func doTestConfigMapDataInVolume(volumePath string, configMap api.ConfigMap, t *testing.T) { func doTestConfigMapDataInVolume(volumePath string, configMap v1.ConfigMap, t *testing.T) {
for key, value := range configMap.Data { for key, value := range configMap.Data {
configMapDataHostPath := path.Join(volumePath, key) configMapDataHostPath := path.Join(volumePath, key)
if _, err := os.Stat(configMapDataHostPath); err != nil { if _, err := os.Stat(configMapDataHostPath); err != nil {
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"sort" "sort"
"strings" "strings"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/fieldpath" "k8s.io/kubernetes/pkg/fieldpath"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
utilerrors "k8s.io/kubernetes/pkg/util/errors" utilerrors "k8s.io/kubernetes/pkg/util/errors"
...@@ -51,7 +51,7 @@ var _ volume.VolumePlugin = &downwardAPIPlugin{} ...@@ -51,7 +51,7 @@ var _ volume.VolumePlugin = &downwardAPIPlugin{}
func wrappedVolumeSpec() volume.Spec { func wrappedVolumeSpec() volume.Spec {
return volume.Spec{ return volume.Spec{
Volume: &api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}}}, Volume: &v1.Volume{VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{Medium: v1.StorageMediumMemory}}},
} }
} }
...@@ -82,7 +82,7 @@ func (plugin *downwardAPIPlugin) RequiresRemount() bool { ...@@ -82,7 +82,7 @@ func (plugin *downwardAPIPlugin) RequiresRemount() bool {
return true return true
} }
func (plugin *downwardAPIPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { func (plugin *downwardAPIPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {
v := &downwardAPIVolume{ v := &downwardAPIVolume{
volName: spec.Name(), volName: spec.Name(),
items: spec.Volume.DownwardAPI.Items, items: spec.Volume.DownwardAPI.Items,
...@@ -108,10 +108,10 @@ func (plugin *downwardAPIPlugin) NewUnmounter(volName string, podUID types.UID) ...@@ -108,10 +108,10 @@ func (plugin *downwardAPIPlugin) NewUnmounter(volName string, podUID types.UID)
} }
func (plugin *downwardAPIPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *downwardAPIPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
downwardAPIVolume := &api.Volume{ downwardAPIVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
DownwardAPI: &api.DownwardAPIVolumeSource{}, DownwardAPI: &v1.DownwardAPIVolumeSource{},
}, },
} }
return volume.NewSpecFromVolume(downwardAPIVolume), nil return volume.NewSpecFromVolume(downwardAPIVolume), nil
...@@ -120,9 +120,9 @@ func (plugin *downwardAPIPlugin) ConstructVolumeSpec(volumeName, mountPath strin ...@@ -120,9 +120,9 @@ func (plugin *downwardAPIPlugin) ConstructVolumeSpec(volumeName, mountPath strin
// downwardAPIVolume retrieves downward API data and placing them into the volume on the host. // downwardAPIVolume retrieves downward API data and placing them into the volume on the host.
type downwardAPIVolume struct { type downwardAPIVolume struct {
volName string volName string
items []api.DownwardAPIVolumeFile items []v1.DownwardAPIVolumeFile
pod *api.Pod pod *v1.Pod
podUID types.UID // TODO: remove this redundancy as soon NewUnmounter func will have *api.POD and not only types.UID podUID types.UID // TODO: remove this redundancy as soon NewUnmounter func will have *v1.POD and not only types.UID
plugin *downwardAPIPlugin plugin *downwardAPIPlugin
volume.MetricsNil volume.MetricsNil
} }
...@@ -131,7 +131,7 @@ type downwardAPIVolume struct { ...@@ -131,7 +131,7 @@ type downwardAPIVolume struct {
// and dumps it in files // and dumps it in files
type downwardAPIVolumeMounter struct { type downwardAPIVolumeMounter struct {
*downwardAPIVolume *downwardAPIVolume
source api.DownwardAPIVolumeSource source v1.DownwardAPIVolumeSource
opts *volume.VolumeOptions opts *volume.VolumeOptions
} }
...@@ -286,9 +286,9 @@ func (b *downwardAPIVolumeMounter) getMetaDir() string { ...@@ -286,9 +286,9 @@ func (b *downwardAPIVolumeMounter) getMetaDir() string {
return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedNameForDisk(downwardAPIPluginName)), b.volName) return path.Join(b.plugin.host.GetPodPluginDir(b.podUID, utilstrings.EscapeQualifiedNameForDisk(downwardAPIPluginName)), b.volName)
} }
func getVolumeSource(spec *volume.Spec) (*api.DownwardAPIVolumeSource, bool) { func getVolumeSource(spec *volume.Spec) (*v1.DownwardAPIVolumeSource, bool) {
var readOnly bool var readOnly bool
var volumeSource *api.DownwardAPIVolumeSource var volumeSource *v1.DownwardAPIVolumeSource
if spec.Volume != nil && spec.Volume.DownwardAPI != nil { if spec.Volume != nil && spec.Volume.DownwardAPI != nil {
volumeSource = spec.Volume.DownwardAPI volumeSource = spec.Volume.DownwardAPI
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"path" "path"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/util/strings"
...@@ -89,12 +89,12 @@ func (plugin *emptyDirPlugin) RequiresRemount() bool { ...@@ -89,12 +89,12 @@ func (plugin *emptyDirPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *emptyDirPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { func (plugin *emptyDirPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(), &realMountDetector{plugin.host.GetMounter()}, opts) return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter(), &realMountDetector{plugin.host.GetMounter()}, opts)
} }
func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *api.Pod, mounter mount.Interface, mountDetector mountDetector, opts volume.VolumeOptions) (volume.Mounter, error) { func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface, mountDetector mountDetector, opts volume.VolumeOptions) (volume.Mounter, error) {
medium := api.StorageMediumDefault medium := v1.StorageMediumDefault
if spec.Volume.EmptyDir != nil { // Support a non-specified source as EmptyDir. if spec.Volume.EmptyDir != nil { // Support a non-specified source as EmptyDir.
medium = spec.Volume.EmptyDir.Medium medium = spec.Volume.EmptyDir.Medium
} }
...@@ -116,9 +116,9 @@ func (plugin *emptyDirPlugin) NewUnmounter(volName string, podUID types.UID) (vo ...@@ -116,9 +116,9 @@ func (plugin *emptyDirPlugin) NewUnmounter(volName string, podUID types.UID) (vo
func (plugin *emptyDirPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface, mountDetector mountDetector) (volume.Unmounter, error) { func (plugin *emptyDirPlugin) newUnmounterInternal(volName string, podUID types.UID, mounter mount.Interface, mountDetector mountDetector) (volume.Unmounter, error) {
ed := &emptyDir{ ed := &emptyDir{
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}}, pod: &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: podUID}},
volName: volName, volName: volName,
medium: api.StorageMediumDefault, // might be changed later medium: v1.StorageMediumDefault, // might be changed later
mounter: mounter, mounter: mounter,
mountDetector: mountDetector, mountDetector: mountDetector,
plugin: plugin, plugin: plugin,
...@@ -128,10 +128,10 @@ func (plugin *emptyDirPlugin) newUnmounterInternal(volName string, podUID types. ...@@ -128,10 +128,10 @@ func (plugin *emptyDirPlugin) newUnmounterInternal(volName string, podUID types.
} }
func (plugin *emptyDirPlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) { func (plugin *emptyDirPlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) {
emptyDirVolume := &api.Volume{ emptyDirVolume := &v1.Volume{
Name: volName, Name: volName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
EmptyDir: &api.EmptyDirVolumeSource{}, EmptyDir: &v1.EmptyDirVolumeSource{},
}, },
} }
return volume.NewSpecFromVolume(emptyDirVolume), nil return volume.NewSpecFromVolume(emptyDirVolume), nil
...@@ -157,9 +157,9 @@ const ( ...@@ -157,9 +157,9 @@ const (
// EmptyDir volumes are temporary directories exposed to the pod. // EmptyDir volumes are temporary directories exposed to the pod.
// These do not persist beyond the lifetime of a pod. // These do not persist beyond the lifetime of a pod.
type emptyDir struct { type emptyDir struct {
pod *api.Pod pod *v1.Pod
volName string volName string
medium api.StorageMedium medium v1.StorageMedium
mounter mount.Interface mounter mount.Interface
mountDetector mountDetector mountDetector mountDetector
plugin *emptyDirPlugin plugin *emptyDirPlugin
...@@ -200,17 +200,17 @@ func (ed *emptyDir) SetUpAt(dir string, fsGroup *int64) error { ...@@ -200,17 +200,17 @@ func (ed *emptyDir) SetUpAt(dir string, fsGroup *int64) error {
// medium is memory, and a mountpoint is present, then the volume is // medium is memory, and a mountpoint is present, then the volume is
// ready. // ready.
if volumeutil.IsReady(ed.getMetaDir()) { if volumeutil.IsReady(ed.getMetaDir()) {
if ed.medium == api.StorageMediumMemory && !notMnt { if ed.medium == v1.StorageMediumMemory && !notMnt {
return nil return nil
} else if ed.medium == api.StorageMediumDefault { } else if ed.medium == v1.StorageMediumDefault {
return nil return nil
} }
} }
switch ed.medium { switch ed.medium {
case api.StorageMediumDefault: case v1.StorageMediumDefault:
err = ed.setupDir(dir) err = ed.setupDir(dir)
case api.StorageMediumMemory: case v1.StorageMediumMemory:
err = ed.setupTmpfs(dir) err = ed.setupTmpfs(dir)
default: default:
err = fmt.Errorf("unknown storage medium %q", ed.medium) err = fmt.Errorf("unknown storage medium %q", ed.medium)
...@@ -305,7 +305,7 @@ func (ed *emptyDir) TearDownAt(dir string) error { ...@@ -305,7 +305,7 @@ func (ed *emptyDir) TearDownAt(dir string) error {
return err return err
} }
if isMnt && medium == mediumMemory { if isMnt && medium == mediumMemory {
ed.medium = api.StorageMediumMemory ed.medium = v1.StorageMediumMemory
return ed.teardownTmpfs(dir) return ed.teardownTmpfs(dir)
} }
// assume StorageMediumDefault // assume StorageMediumDefault
...@@ -341,9 +341,9 @@ func (ed *emptyDir) getMetaDir() string { ...@@ -341,9 +341,9 @@ func (ed *emptyDir) getMetaDir() string {
return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, strings.EscapeQualifiedNameForDisk(emptyDirPluginName)), ed.volName) return path.Join(ed.plugin.host.GetPodPluginDir(ed.pod.UID, strings.EscapeQualifiedNameForDisk(emptyDirPluginName)), ed.volName)
} }
func getVolumeSource(spec *volume.Spec) (*api.EmptyDirVolumeSource, bool) { func getVolumeSource(spec *volume.Spec) (*v1.EmptyDirVolumeSource, bool) {
var readOnly bool var readOnly bool
var volumeSource *api.EmptyDirVolumeSource var volumeSource *v1.EmptyDirVolumeSource
if spec.Volume != nil && spec.Volume.EmptyDir != nil { if spec.Volume != nil && spec.Volume.EmptyDir != nil {
volumeSource = spec.Volume.EmptyDir volumeSource = spec.Volume.EmptyDir
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"path" "path"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -55,10 +55,10 @@ func TestCanSupport(t *testing.T) { ...@@ -55,10 +55,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/empty-dir" { if plug.GetPluginName() != "kubernetes.io/empty-dir" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -74,13 +74,13 @@ func (fake *fakeMountDetector) GetMountMedium(path string) (storageMedium, bool, ...@@ -74,13 +74,13 @@ func (fake *fakeMountDetector) GetMountMedium(path string) (storageMedium, bool,
func TestPluginEmptyRootContext(t *testing.T) { func TestPluginEmptyRootContext(t *testing.T) {
doTestPlugin(t, pluginTestConfig{ doTestPlugin(t, pluginTestConfig{
medium: api.StorageMediumDefault, medium: v1.StorageMediumDefault,
expectedSetupMounts: 0, expectedSetupMounts: 0,
expectedTeardownMounts: 0}) expectedTeardownMounts: 0})
} }
type pluginTestConfig struct { type pluginTestConfig struct {
medium api.StorageMedium medium v1.StorageMedium
idempotent bool idempotent bool
expectedSetupMounts int expectedSetupMounts int
shouldBeMountedBeforeTeardown bool shouldBeMountedBeforeTeardown bool
...@@ -101,14 +101,14 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) { ...@@ -101,14 +101,14 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) {
plug = makePluginUnderTest(t, "kubernetes.io/empty-dir", basePath) plug = makePluginUnderTest(t, "kubernetes.io/empty-dir", basePath)
volumeName = "test-volume" volumeName = "test-volume"
spec = &api.Volume{ spec = &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: config.medium}}, VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{Medium: config.medium}},
} }
physicalMounter = mount.FakeMounter{} physicalMounter = mount.FakeMounter{}
mountDetector = fakeMountDetector{} mountDetector = fakeMountDetector{}
pod = &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod = &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
) )
if config.idempotent { if config.idempotent {
...@@ -171,7 +171,7 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) { ...@@ -171,7 +171,7 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) {
// Make an unmounter for the volume // Make an unmounter for the volume
teardownMedium := mediumUnknown teardownMedium := mediumUnknown
if config.medium == api.StorageMediumMemory { if config.medium == v1.StorageMediumMemory {
teardownMedium = mediumMemory teardownMedium = mediumMemory
} }
unmounterMountDetector := &fakeMountDetector{medium: teardownMedium, isMount: config.shouldBeMountedBeforeTeardown} unmounterMountDetector := &fakeMountDetector{medium: teardownMedium, isMount: config.shouldBeMountedBeforeTeardown}
...@@ -211,10 +211,10 @@ func TestPluginBackCompat(t *testing.T) { ...@@ -211,10 +211,10 @@ func TestPluginBackCompat(t *testing.T) {
plug := makePluginUnderTest(t, "kubernetes.io/empty-dir", basePath) plug := makePluginUnderTest(t, "kubernetes.io/empty-dir", basePath)
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -240,10 +240,10 @@ func TestMetrics(t *testing.T) { ...@@ -240,10 +240,10 @@ func TestMetrics(t *testing.T) {
plug := makePluginUnderTest(t, "kubernetes.io/empty-dir", tmpDir) plug := makePluginUnderTest(t, "kubernetes.io/empty-dir", tmpDir)
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
"strconv" "strconv"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -77,14 +77,14 @@ func (plugin *fcPlugin) RequiresRemount() bool { ...@@ -77,14 +77,14 @@ func (plugin *fcPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *fcPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *fcPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
} }
} }
func (plugin *fcPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *fcPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newMounterInternal(spec, pod.UID, &FCUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &FCUtil{}, plugin.host.GetMounter())
} }
...@@ -142,10 +142,10 @@ func (plugin *fcPlugin) execCommand(command string, args []string) ([]byte, erro ...@@ -142,10 +142,10 @@ func (plugin *fcPlugin) execCommand(command string, args []string) ([]byte, erro
} }
func (plugin *fcPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *fcPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
fcVolume := &api.Volume{ fcVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
FC: &api.FCVolumeSource{}, FC: &v1.FCVolumeSource{},
}, },
} }
return volume.NewSpecFromVolume(fcVolume), nil return volume.NewSpecFromVolume(fcVolume), nil
...@@ -225,7 +225,7 @@ func (c *fcDiskUnmounter) TearDownAt(dir string) error { ...@@ -225,7 +225,7 @@ func (c *fcDiskUnmounter) TearDownAt(dir string) error {
return diskTearDown(c.manager, *c, dir, c.mounter) return diskTearDown(c.manager, *c, dir, c.mounter)
} }
func getVolumeSource(spec *volume.Spec) (*api.FCVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.FCVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.FC != nil { if spec.Volume != nil && spec.Volume.FC != nil {
return spec.Volume.FC, spec.Volume.FC.ReadOnly, nil return spec.Volume.FC, spec.Volume.FC.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -47,7 +47,7 @@ func TestCanSupport(t *testing.T) { ...@@ -47,7 +47,7 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/fc" { if plug.GetPluginName() != "kubernetes.io/fc" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -66,12 +66,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -66,12 +66,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) {
t.Errorf("Expected two AccessModeTypes: %s and %s", api.ReadWriteOnce, api.ReadOnlyMany) t.Errorf("Expected two AccessModeTypes: %s and %s", v1.ReadWriteOnce, v1.ReadOnlyMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -200,10 +200,10 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -200,10 +200,10 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
func TestPluginVolume(t *testing.T) { func TestPluginVolume(t *testing.T) {
lun := int32(0) lun := int32(0)
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
FC: &api.FCVolumeSource{ FC: &v1.FCVolumeSource{
TargetWWNs: []string{"some_wwn"}, TargetWWNs: []string{"some_wwn"},
FSType: "ext4", FSType: "ext4",
Lun: &lun, Lun: &lun,
...@@ -215,13 +215,13 @@ func TestPluginVolume(t *testing.T) { ...@@ -215,13 +215,13 @@ func TestPluginVolume(t *testing.T) {
func TestPluginPersistentVolume(t *testing.T) { func TestPluginPersistentVolume(t *testing.T) {
lun := int32(0) lun := int32(0)
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
FC: &api.FCVolumeSource{ FC: &v1.FCVolumeSource{
TargetWWNs: []string{"some_wwn"}, TargetWWNs: []string{"some_wwn"},
FSType: "ext4", FSType: "ext4",
Lun: &lun, Lun: &lun,
...@@ -240,34 +240,34 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -240,34 +240,34 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
lun := int32(0) lun := int32(0)
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
FC: &api.FCVolumeSource{ FC: &v1.FCVolumeSource{
TargetWWNs: []string{"some_wwn"}, TargetWWNs: []string{"some_wwn"},
FSType: "ext4", FSType: "ext4",
Lun: &lun, Lun: &lun,
}, },
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -279,7 +279,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -279,7 +279,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
"strings" "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -97,15 +97,15 @@ func (plugin *flexVolumePlugin) RequiresRemount() bool { ...@@ -97,15 +97,15 @@ func (plugin *flexVolumePlugin) RequiresRemount() bool {
} }
// GetAccessModes gets the allowed access modes for this plugin. // GetAccessModes gets the allowed access modes for this plugin.
func (plugin *flexVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *flexVolumePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
} }
} }
// NewMounter is the mounter routine to build the volume. // NewMounter is the mounter routine to build the volume.
func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
fv, _, err := getVolumeSource(spec) fv, _, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -131,7 +131,7 @@ func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ vo ...@@ -131,7 +131,7 @@ func (plugin *flexVolumePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ vo
} }
// newMounterInternal is the internal mounter routine to build the volume. // newMounterInternal is the internal mounter routine to build the volume.
func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.Pod, manager flexVolumeManager, mounter mount.Interface, runner exec.Interface, secrets map[string]string) (volume.Mounter, error) { func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, manager flexVolumeManager, mounter mount.Interface, runner exec.Interface, secrets map[string]string) (volume.Mounter, error) {
source, _, err := getVolumeSource(spec) source, _, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -180,10 +180,10 @@ func (plugin *flexVolumePlugin) newUnmounterInternal(volName string, podUID type ...@@ -180,10 +180,10 @@ func (plugin *flexVolumePlugin) newUnmounterInternal(volName string, podUID type
} }
func (plugin *flexVolumePlugin) ConstructVolumeSpec(volumeName, sourceName string) (*volume.Spec, error) { func (plugin *flexVolumePlugin) ConstructVolumeSpec(volumeName, sourceName string) (*volume.Spec, error) {
flexVolume := &api.Volume{ flexVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
FlexVolume: &api.FlexVolumeSource{ FlexVolume: &v1.FlexVolumeSource{
Driver: sourceName, Driver: sourceName,
}, },
}, },
...@@ -420,7 +420,7 @@ func (f *flexVolumeUnmounter) TearDownAt(dir string) error { ...@@ -420,7 +420,7 @@ func (f *flexVolumeUnmounter) TearDownAt(dir string) error {
return nil return nil
} }
func getVolumeSource(spec *volume.Spec) (*api.FlexVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.FlexVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.FlexVolume != nil { if spec.Volume != nil && spec.Volume.FlexVolume != nil {
return spec.Volume.FlexVolume, spec.Volume.FlexVolume.ReadOnly, nil return spec.Volume.FlexVolume, spec.Volume.FlexVolume.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
"testing" "testing"
"text/template" "text/template"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -190,13 +190,13 @@ func TestCanSupport(t *testing.T) { ...@@ -190,13 +190,13 @@ func TestCanSupport(t *testing.T) {
if plugin.GetPluginName() != "kubernetes.io/fakeAttacher" { if plugin.GetPluginName() != "kubernetes.io/fakeAttacher" {
t.Errorf("Wrong name: %s", plugin.GetPluginName()) t.Errorf("Wrong name: %s", plugin.GetPluginName())
} }
if !plugin.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{FlexVolume: &api.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher"}}}}) { if !plugin.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{FlexVolume: &v1.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher"}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plugin.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{FlexVolume: &api.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher"}}}}}) { if !plugin.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{FlexVolume: &v1.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher"}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if plugin.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plugin.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -216,12 +216,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -216,12 +216,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Can't find the plugin by name") t.Fatalf("Can't find the plugin by name")
} }
if !contains(plugin.GetAccessModes(), api.ReadWriteOnce) || !contains(plugin.GetAccessModes(), api.ReadOnlyMany) { if !contains(plugin.GetAccessModes(), v1.ReadWriteOnce) || !contains(plugin.GetAccessModes(), v1.ReadOnlyMany) {
t.Errorf("Expected two AccessModeTypes: %s and %s", api.ReadWriteOnce, api.ReadOnlyMany) t.Errorf("Expected two AccessModeTypes: %s and %s", v1.ReadWriteOnce, v1.ReadOnlyMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -239,7 +239,7 @@ func doTestPluginAttachDetach(t *testing.T, spec *volume.Spec, tmpDir string) { ...@@ -239,7 +239,7 @@ func doTestPluginAttachDetach(t *testing.T, spec *volume.Spec, tmpDir string) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
fake := &mount.FakeMounter{} fake := &mount.FakeMounter{}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
secretMap := make(map[string]string) secretMap := make(map[string]string)
secretMap["flexsecret"] = base64.StdEncoding.EncodeToString([]byte("foo")) secretMap["flexsecret"] = base64.StdEncoding.EncodeToString([]byte("foo"))
mounter, err := plugin.(*flexVolumePlugin).newMounterInternal(spec, pod, &flexVolumeUtil{}, fake, exec.New(), secretMap) mounter, err := plugin.(*flexVolumePlugin).newMounterInternal(spec, pod, &flexVolumeUtil{}, fake, exec.New(), secretMap)
...@@ -320,7 +320,7 @@ func doTestPluginMountUnmount(t *testing.T, spec *volume.Spec, tmpDir string) { ...@@ -320,7 +320,7 @@ func doTestPluginMountUnmount(t *testing.T, spec *volume.Spec, tmpDir string) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
fake := &mount.FakeMounter{} fake := &mount.FakeMounter{}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
// Use nil secret to test for nil secret case. // Use nil secret to test for nil secret case.
mounter, err := plugin.(*flexVolumePlugin).newMounterInternal(spec, pod, &flexVolumeUtil{}, fake, exec.New(), nil) mounter, err := plugin.(*flexVolumePlugin).newMounterInternal(spec, pod, &flexVolumeUtil{}, fake, exec.New(), nil)
volumePath := mounter.GetPath() volumePath := mounter.GetPath()
...@@ -374,9 +374,9 @@ func TestPluginVolumeAttacher(t *testing.T) { ...@@ -374,9 +374,9 @@ func TestPluginVolumeAttacher(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{FlexVolume: &api.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher", ReadOnly: false}}, VolumeSource: v1.VolumeSource{FlexVolume: &v1.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher", ReadOnly: false}},
} }
doTestPluginAttachDetach(t, volume.NewSpecFromVolume(vol), tmpDir) doTestPluginAttachDetach(t, volume.NewSpecFromVolume(vol), tmpDir)
} }
...@@ -388,9 +388,9 @@ func TestPluginVolumeMounter(t *testing.T) { ...@@ -388,9 +388,9 @@ func TestPluginVolumeMounter(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{FlexVolume: &api.FlexVolumeSource{Driver: "kubernetes.io/fakeMounter", ReadOnly: false}}, VolumeSource: v1.VolumeSource{FlexVolume: &v1.FlexVolumeSource{Driver: "kubernetes.io/fakeMounter", ReadOnly: false}},
} }
doTestPluginMountUnmount(t, volume.NewSpecFromVolume(vol), tmpDir) doTestPluginMountUnmount(t, volume.NewSpecFromVolume(vol), tmpDir)
} }
...@@ -402,13 +402,13 @@ func TestPluginPersistentVolume(t *testing.T) { ...@@ -402,13 +402,13 @@ func TestPluginPersistentVolume(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
FlexVolume: &api.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher", ReadOnly: false}, FlexVolume: &v1.FlexVolumeSource{Driver: "kubernetes.io/fakeAttacher", ReadOnly: false},
}, },
}, },
} }
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/env" "k8s.io/kubernetes/pkg/util/env"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -49,7 +49,7 @@ type flockerVolume struct { ...@@ -49,7 +49,7 @@ type flockerVolume struct {
datasetName string datasetName string
// dataset uuid // dataset uuid
datasetUUID string datasetUUID string
//pod *api.Pod //pod *v1.Pod
flockerClient flockerApi.Clientable flockerClient flockerApi.Clientable
manager volumeManager manager volumeManager
plugin *flockerPlugin plugin *flockerPlugin
...@@ -111,13 +111,13 @@ func (p *flockerPlugin) RequiresRemount() bool { ...@@ -111,13 +111,13 @@ func (p *flockerPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *flockerPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *flockerPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
} }
} }
func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*api.FlockerVolumeSource, bool) { func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*v1.FlockerVolumeSource, bool) {
// AFAIK this will always be r/w, but perhaps for the future it will be needed // AFAIK this will always be r/w, but perhaps for the future it will be needed
readOnly := false readOnly := false
...@@ -127,7 +127,7 @@ func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*api.FlockerV ...@@ -127,7 +127,7 @@ func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*api.FlockerV
return spec.PersistentVolume.Spec.Flocker, readOnly return spec.PersistentVolume.Spec.Flocker, readOnly
} }
func (plugin *flockerPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *flockerPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newMounterInternal(spec, pod.UID, &FlockerUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &FlockerUtil{}, plugin.host.GetMounter())
} }
...@@ -172,10 +172,10 @@ func (p *flockerPlugin) newUnmounterInternal(volName string, podUID types.UID, m ...@@ -172,10 +172,10 @@ func (p *flockerPlugin) newUnmounterInternal(volName string, podUID types.UID, m
} }
func (p *flockerPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (p *flockerPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
flockerVolume := &api.Volume{ flockerVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Flocker: &api.FlockerVolumeSource{ Flocker: &v1.FlockerVolumeSource{
DatasetName: volumeName, DatasetName: volumeName,
}, },
}, },
...@@ -392,7 +392,7 @@ func (b *flockerVolumeMounter) updateDatasetPrimary(datasetUUID string, primaryU ...@@ -392,7 +392,7 @@ func (b *flockerVolumeMounter) updateDatasetPrimary(datasetUUID string, primaryU
} }
func getVolumeSource(spec *volume.Spec) (*api.FlockerVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.FlockerVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.Flocker != nil { if spec.Volume != nil && spec.Volume.Flocker != nil {
return spec.Volume.Flocker, spec.ReadOnly, nil return spec.Volume.Flocker, spec.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -144,10 +144,10 @@ func TestPlugin(t *testing.T) { ...@@ -144,10 +144,10 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Flocker: &api.FlockerVolumeSource{ Flocker: &v1.FlockerVolumeSource{
DatasetUUID: "uuid1", DatasetUUID: "uuid1",
}, },
}, },
...@@ -181,24 +181,24 @@ func TestCanSupport(t *testing.T) { ...@@ -181,24 +181,24 @@ func TestCanSupport(t *testing.T) {
specs := map[*volume.Spec]bool{ specs := map[*volume.Spec]bool{
&volume.Spec{ &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Flocker: &api.FlockerVolumeSource{}, Flocker: &v1.FlockerVolumeSource{},
}, },
}, },
}: true, }: true,
&volume.Spec{ &volume.Spec{
PersistentVolume: &api.PersistentVolume{ PersistentVolume: &v1.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Flocker: &api.FlockerVolumeSource{}, Flocker: &v1.FlockerVolumeSource{},
}, },
}, },
}, },
}: true, }: true,
&volume.Spec{ &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{}, VolumeSource: v1.VolumeSource{},
}, },
}: false, }: false,
} }
...@@ -215,9 +215,9 @@ func TestGetFlockerVolumeSource(t *testing.T) { ...@@ -215,9 +215,9 @@ func TestGetFlockerVolumeSource(t *testing.T) {
p := flockerPlugin{} p := flockerPlugin{}
spec := &volume.Spec{ spec := &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Flocker: &api.FlockerVolumeSource{}, Flocker: &v1.FlockerVolumeSource{},
}, },
}, },
} }
...@@ -226,10 +226,10 @@ func TestGetFlockerVolumeSource(t *testing.T) { ...@@ -226,10 +226,10 @@ func TestGetFlockerVolumeSource(t *testing.T) {
assert.Equal(spec.Volume.Flocker, vs) assert.Equal(spec.Volume.Flocker, vs)
spec = &volume.Spec{ spec = &volume.Spec{
PersistentVolume: &api.PersistentVolume{ PersistentVolume: &v1.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Flocker: &api.FlockerVolumeSource{}, Flocker: &v1.FlockerVolumeSource{},
}, },
}, },
}, },
...@@ -247,16 +247,16 @@ func TestNewMounterDatasetName(t *testing.T) { ...@@ -247,16 +247,16 @@ func TestNewMounterDatasetName(t *testing.T) {
assert.NoError(err) assert.NoError(err)
spec := &volume.Spec{ spec := &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Flocker: &api.FlockerVolumeSource{ Flocker: &v1.FlockerVolumeSource{
DatasetName: "something", DatasetName: "something",
}, },
}, },
}, },
} }
_, err = plug.NewMounter(spec, &api.Pod{}, volume.VolumeOptions{}) _, err = plug.NewMounter(spec, &v1.Pod{}, volume.VolumeOptions{})
assert.NoError(err) assert.NoError(err)
} }
...@@ -268,16 +268,16 @@ func TestNewMounterDatasetUUID(t *testing.T) { ...@@ -268,16 +268,16 @@ func TestNewMounterDatasetUUID(t *testing.T) {
assert.NoError(err) assert.NoError(err)
spec := &volume.Spec{ spec := &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Flocker: &api.FlockerVolumeSource{ Flocker: &v1.FlockerVolumeSource{
DatasetUUID: "uuid1", DatasetUUID: "uuid1",
}, },
}, },
}, },
} }
mounter, err := plug.NewMounter(spec, &api.Pod{}, volume.VolumeOptions{}) mounter, err := plug.NewMounter(spec, &v1.Pod{}, volume.VolumeOptions{})
assert.NoError(err) assert.NoError(err)
assert.NotNil(mounter, "got a nil mounter") assert.NotNil(mounter, "got a nil mounter")
...@@ -349,7 +349,7 @@ func TestSetUpAtInternal(t *testing.T) { ...@@ -349,7 +349,7 @@ func TestSetUpAtInternal(t *testing.T) {
plug, err := plugMgr.FindPluginByName(flockerPluginName) plug, err := plugMgr.FindPluginByName(flockerPluginName)
assert.NoError(err) assert.NoError(err)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
b := flockerVolumeMounter{flockerVolume: &flockerVolume{pod: pod, plugin: plug.(*flockerPlugin)}} b := flockerVolumeMounter{flockerVolume: &flockerVolume{pod: pod, plugin: plug.(*flockerPlugin)}}
b.client = newMockFlockerClient("dataset-id", "primary-uid", mockPath) b.client = newMockFlockerClient("dataset-id", "primary-uid", mockPath)
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"time" "time"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/rand" "k8s.io/kubernetes/pkg/util/rand"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
...@@ -71,7 +71,7 @@ func (util *FlockerUtil) CreateVolume(c *flockerVolumeProvisioner) (datasetUUID ...@@ -71,7 +71,7 @@ func (util *FlockerUtil) CreateVolume(c *flockerVolumeProvisioner) (datasetUUID
node := nodes[rand.Intn(len(nodes))] node := nodes[rand.Intn(len(nodes))]
glog.V(2).Infof("selected flocker node with UUID '%s' to provision dataset", node.UUID) glog.V(2).Infof("selected flocker node with UUID '%s' to provision dataset", node.UUID)
capacity := c.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
requestBytes := capacity.Value() requestBytes := capacity.Value()
volumeSizeGB = int(volume.RoundUpSize(requestBytes, 1024*1024*1024)) volumeSizeGB = int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
...@@ -31,10 +31,10 @@ func TestFlockerUtil_CreateVolume(t *testing.T) { ...@@ -31,10 +31,10 @@ func TestFlockerUtil_CreateVolume(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
// test CreateVolume happy path // test CreateVolume happy path
pvc := volumetest.CreateTestPVC("3Gi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}) pvc := volumetest.CreateTestPVC("3Gi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce})
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: pvc, PVC: pvc,
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
fakeFlockerClient := newFakeFlockerClient() fakeFlockerClient := newFakeFlockerClient()
......
...@@ -19,8 +19,8 @@ package flocker ...@@ -19,8 +19,8 @@ package flocker
import ( import (
"fmt" "fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
) )
...@@ -52,7 +52,7 @@ type flockerVolumeProvisioner struct { ...@@ -52,7 +52,7 @@ type flockerVolumeProvisioner struct {
var _ volume.Provisioner = &flockerVolumeProvisioner{} var _ volume.Provisioner = &flockerVolumeProvisioner{}
func (c *flockerVolumeProvisioner) Provision() (*api.PersistentVolume, error) { func (c *flockerVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
if len(c.options.Parameters) > 0 { if len(c.options.Parameters) > 0 {
return nil, fmt.Errorf("Provisioning failed: Specified at least one unsupported parameter") return nil, fmt.Errorf("Provisioning failed: Specified at least one unsupported parameter")
...@@ -67,22 +67,22 @@ func (c *flockerVolumeProvisioner) Provision() (*api.PersistentVolume, error) { ...@@ -67,22 +67,22 @@ func (c *flockerVolumeProvisioner) Provision() (*api.PersistentVolume, error) {
return nil, err return nil, err
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: c.options.PVName, Name: c.options.PVName,
Labels: map[string]string{}, Labels: map[string]string{},
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "flocker-dynamic-provisioner", "kubernetes.io/createdby": "flocker-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy,
AccessModes: c.options.PVC.Spec.AccessModes, AccessModes: c.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Flocker: &api.FlockerVolumeSource{ Flocker: &v1.FlockerVolumeSource{
DatasetUUID: datasetUUID, DatasetUUID: datasetUUID,
}, },
}, },
......
...@@ -20,8 +20,8 @@ import ( ...@@ -20,8 +20,8 @@ import (
"fmt" "fmt"
"testing" "testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
...@@ -47,10 +47,10 @@ func newTestableProvisioner(assert *assert.Assertions, options volume.VolumeOpti ...@@ -47,10 +47,10 @@ func newTestableProvisioner(assert *assert.Assertions, options volume.VolumeOpti
func TestProvision(t *testing.T) { func TestProvision(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
pvc := volumetest.CreateTestPVC("3Gi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}) pvc := volumetest.CreateTestPVC("3Gi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce})
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: pvc, PVC: pvc,
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
provisioner := newTestableProvisioner(assert, options) provisioner := newTestableProvisioner(assert, options)
...@@ -58,7 +58,7 @@ func TestProvision(t *testing.T) { ...@@ -58,7 +58,7 @@ func TestProvision(t *testing.T) {
persistentSpec, err := provisioner.Provision() persistentSpec, err := provisioner.Provision()
assert.NoError(err, "Provision() failed: ", err) assert.NoError(err, "Provision() failed: ", err)
cap := persistentSpec.Spec.Capacity[api.ResourceStorage] cap := persistentSpec.Spec.Capacity[v1.ResourceStorage]
assert.Equal(int64(3*1024*1024*1024), cap.Value()) assert.Equal(int64(3*1024*1024*1024), cap.Value())
...@@ -75,7 +75,7 @@ func TestProvision(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestProvision(t *testing.T) {
// parameters are not supported // parameters are not supported
options = volume.VolumeOptions{ options = volume.VolumeOptions{
PVC: pvc, PVC: pvc,
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
Parameters: map[string]string{ Parameters: map[string]string{
"not-supported-params": "test123", "not-supported-params": "test123",
}, },
...@@ -89,7 +89,7 @@ func TestProvision(t *testing.T) { ...@@ -89,7 +89,7 @@ func TestProvision(t *testing.T) {
pvc.Spec.Selector = &unversioned.LabelSelector{MatchLabels: map[string]string{"key": "value"}} pvc.Spec.Selector = &unversioned.LabelSelector{MatchLabels: map[string]string{"key": "value"}}
options = volume.VolumeOptions{ options = volume.VolumeOptions{
PVC: pvc, PVC: pvc,
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
provisioner = newTestableProvisioner(assert, options) provisioner = newTestableProvisioner(assert, options)
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
...@@ -224,9 +224,9 @@ func newDetacher(testcase *testcase) *gcePersistentDiskDetacher { ...@@ -224,9 +224,9 @@ func newDetacher(testcase *testcase) *gcePersistentDiskDetacher {
func createVolSpec(name string, readOnly bool) *volume.Spec { func createVolSpec(name string, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: name, PDName: name,
ReadOnly: readOnly, ReadOnly: readOnly,
}, },
...@@ -237,10 +237,10 @@ func createVolSpec(name string, readOnly bool) *volume.Spec { ...@@ -237,10 +237,10 @@ func createVolSpec(name string, readOnly bool) *volume.Spec {
func createPVSpec(name string, readOnly bool) *volume.Spec { func createPVSpec(name string, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
PersistentVolume: &api.PersistentVolume{ PersistentVolume: &v1.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: name, PDName: name,
ReadOnly: readOnly, ReadOnly: readOnly,
}, },
......
...@@ -23,8 +23,8 @@ import ( ...@@ -23,8 +23,8 @@ import (
"strconv" "strconv"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/util/strings"
...@@ -80,20 +80,20 @@ func (plugin *gcePersistentDiskPlugin) RequiresRemount() bool { ...@@ -80,20 +80,20 @@ func (plugin *gcePersistentDiskPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *gcePersistentDiskPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *gcePersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
} }
} }
func (plugin *gcePersistentDiskPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *gcePersistentDiskPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newMounterInternal(spec, pod.UID, &GCEDiskUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &GCEDiskUtil{}, plugin.host.GetMounter())
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.GCEPersistentDiskVolumeSource, bool, error) { spec *volume.Spec) (*v1.GCEPersistentDiskVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.GCEPersistentDisk != nil { if spec.Volume != nil && spec.Volume.GCEPersistentDisk != nil {
return spec.Volume.GCEPersistentDisk, spec.Volume.GCEPersistentDisk.ReadOnly, nil return spec.Volume.GCEPersistentDisk, spec.Volume.GCEPersistentDisk.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
...@@ -186,10 +186,10 @@ func (plugin *gcePersistentDiskPlugin) ConstructVolumeSpec(volumeName, mountPath ...@@ -186,10 +186,10 @@ func (plugin *gcePersistentDiskPlugin) ConstructVolumeSpec(volumeName, mountPath
if err != nil { if err != nil {
return nil, err return nil, err
} }
gceVolume := &api.Volume{ gceVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: sourceName, PDName: sourceName,
}, },
}, },
...@@ -381,28 +381,28 @@ type gcePersistentDiskProvisioner struct { ...@@ -381,28 +381,28 @@ type gcePersistentDiskProvisioner struct {
var _ volume.Provisioner = &gcePersistentDiskProvisioner{} var _ volume.Provisioner = &gcePersistentDiskProvisioner{}
func (c *gcePersistentDiskProvisioner) Provision() (*api.PersistentVolume, error) { func (c *gcePersistentDiskProvisioner) Provision() (*v1.PersistentVolume, error) {
volumeID, sizeGB, labels, err := c.manager.CreateVolume(c) volumeID, sizeGB, labels, err := c.manager.CreateVolume(c)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: c.options.PVName, Name: c.options.PVName,
Labels: map[string]string{}, Labels: map[string]string{},
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "gce-pd-dynamic-provisioner", "kubernetes.io/createdby": "gce-pd-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: c.options.PersistentVolumeReclaimPolicy,
AccessModes: c.options.PVC.Spec.AccessModes, AccessModes: c.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: volumeID, PDName: volumeID,
Partition: 0, Partition: 0,
ReadOnly: false, ReadOnly: false,
......
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
"path" "path"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -47,10 +47,10 @@ func TestCanSupport(t *testing.T) { ...@@ -47,10 +47,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/gce-pd" { if plug.GetPluginName() != "kubernetes.io/gce-pd" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -68,12 +68,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -68,12 +68,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) {
t.Errorf("Expected two AccessModeTypes: %s and %s", api.ReadWriteOnce, api.ReadOnlyMany) t.Errorf("Expected two AccessModeTypes: %s and %s", v1.ReadWriteOnce, v1.ReadOnlyMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -111,10 +111,10 @@ func TestPlugin(t *testing.T) { ...@@ -111,10 +111,10 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: "pd", PDName: "pd",
FSType: "ext4", FSType: "ext4",
}, },
...@@ -174,8 +174,8 @@ func TestPlugin(t *testing.T) { ...@@ -174,8 +174,8 @@ func TestPlugin(t *testing.T) {
// Test Provisioner // Test Provisioner
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: volumetest.CreateTestPVC("100Mi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}), PVC: volumetest.CreateTestPVC("100Mi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
provisioner, err := plug.(*gcePersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{}) provisioner, err := plug.(*gcePersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{})
persistentSpec, err := provisioner.Provision() persistentSpec, err := provisioner.Provision()
...@@ -186,7 +186,7 @@ func TestPlugin(t *testing.T) { ...@@ -186,7 +186,7 @@ func TestPlugin(t *testing.T) {
if persistentSpec.Spec.PersistentVolumeSource.GCEPersistentDisk.PDName != "test-gce-volume-name" { if persistentSpec.Spec.PersistentVolumeSource.GCEPersistentDisk.PDName != "test-gce-volume-name" {
t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.GCEPersistentDisk.PDName) t.Errorf("Provision() returned unexpected volume ID: %s", persistentSpec.Spec.PersistentVolumeSource.GCEPersistentDisk.PDName)
} }
cap := persistentSpec.Spec.Capacity[api.ResourceStorage] cap := persistentSpec.Spec.Capacity[v1.ResourceStorage]
size := cap.Value() size := cap.Value()
if size != 100*1024*1024*1024 { if size != 100*1024*1024*1024 {
t.Errorf("Provision() returned unexpected volume size: %v", size) t.Errorf("Provision() returned unexpected volume size: %v", size)
...@@ -208,30 +208,30 @@ func TestPlugin(t *testing.T) { ...@@ -208,30 +208,30 @@ func TestPlugin(t *testing.T) {
} }
func TestPersistentClaimReadOnlyFlag(t *testing.T) { func TestPersistentClaimReadOnlyFlag(t *testing.T) {
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}, GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -248,7 +248,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -248,7 +248,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
gcecloud "k8s.io/kubernetes/pkg/cloudprovider/providers/gce" gcecloud "k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
...@@ -78,7 +78,7 @@ func (gceutil *GCEDiskUtil) CreateVolume(c *gcePersistentDiskProvisioner) (strin ...@@ -78,7 +78,7 @@ func (gceutil *GCEDiskUtil) CreateVolume(c *gcePersistentDiskProvisioner) (strin
} }
name := volume.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 63) // GCE PD name can have up to 63 characters name := volume.GenerateVolumeName(c.options.ClusterName, c.options.PVName, 63) // GCE PD name can have up to 63 characters
capacity := c.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := c.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
requestBytes := capacity.Value() requestBytes := capacity.Value()
// GCE works with gigabytes, convert to GiB with rounding up // GCE works with gigabytes, convert to GiB with rounding up
requestGB := volume.RoundUpSize(requestBytes, 1024*1024*1024) requestGB := volume.RoundUpSize(requestBytes, 1024*1024*1024)
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"path" "path"
"strings" "strings"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
utilstrings "k8s.io/kubernetes/pkg/util/strings" utilstrings "k8s.io/kubernetes/pkg/util/strings"
...@@ -43,7 +43,7 @@ var _ volume.VolumePlugin = &gitRepoPlugin{} ...@@ -43,7 +43,7 @@ var _ volume.VolumePlugin = &gitRepoPlugin{}
func wrappedVolumeSpec() volume.Spec { func wrappedVolumeSpec() volume.Spec {
return volume.Spec{ return volume.Spec{
Volume: &api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, Volume: &v1.Volume{VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}},
} }
} }
...@@ -81,7 +81,7 @@ func (plugin *gitRepoPlugin) RequiresRemount() bool { ...@@ -81,7 +81,7 @@ func (plugin *gitRepoPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *gitRepoPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { func (plugin *gitRepoPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {
return &gitRepoVolumeMounter{ return &gitRepoVolumeMounter{
gitRepoVolume: &gitRepoVolume{ gitRepoVolume: &gitRepoVolume{
volName: spec.Name(), volName: spec.Name(),
...@@ -108,10 +108,10 @@ func (plugin *gitRepoPlugin) NewUnmounter(volName string, podUID types.UID) (vol ...@@ -108,10 +108,10 @@ func (plugin *gitRepoPlugin) NewUnmounter(volName string, podUID types.UID) (vol
} }
func (plugin *gitRepoPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *gitRepoPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
gitVolume := &api.Volume{ gitVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GitRepo: &api.GitRepoVolumeSource{}, GitRepo: &v1.GitRepoVolumeSource{},
}, },
} }
return volume.NewSpecFromVolume(gitVolume), nil return volume.NewSpecFromVolume(gitVolume), nil
...@@ -137,7 +137,7 @@ func (gr *gitRepoVolume) GetPath() string { ...@@ -137,7 +137,7 @@ func (gr *gitRepoVolume) GetPath() string {
type gitRepoVolumeMounter struct { type gitRepoVolumeMounter struct {
*gitRepoVolume *gitRepoVolume
pod api.Pod pod v1.Pod
source string source string
revision string revision string
target string target string
...@@ -263,9 +263,9 @@ func (c *gitRepoVolumeUnmounter) TearDownAt(dir string) error { ...@@ -263,9 +263,9 @@ func (c *gitRepoVolumeUnmounter) TearDownAt(dir string) error {
return wrapped.TearDownAt(dir) return wrapped.TearDownAt(dir)
} }
func getVolumeSource(spec *volume.Spec) (*api.GitRepoVolumeSource, bool) { func getVolumeSource(spec *volume.Spec) (*v1.GitRepoVolumeSource, bool) {
var readOnly bool var readOnly bool
var volumeSource *api.GitRepoVolumeSource var volumeSource *v1.GitRepoVolumeSource
if spec.Volume != nil && spec.Volume.GitRepo != nil { if spec.Volume != nil && spec.Volume.GitRepo != nil {
volumeSource = spec.Volume.GitRepo volumeSource = spec.Volume.GitRepo
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
...@@ -54,7 +54,7 @@ func TestCanSupport(t *testing.T) { ...@@ -54,7 +54,7 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/git-repo" { if plug.GetPluginName() != "kubernetes.io/git-repo" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{GitRepo: &v1.GitRepoVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -73,16 +73,16 @@ func TestPlugin(t *testing.T) { ...@@ -73,16 +73,16 @@ func TestPlugin(t *testing.T) {
scenarios := []struct { scenarios := []struct {
name string name string
vol *api.Volume vol *v1.Volume
expecteds []expectedCommand expecteds []expectedCommand
isExpectedFailure bool isExpectedFailure bool
}{ }{
{ {
name: "target-dir", name: "target-dir",
vol: &api.Volume{ vol: &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GitRepo: &api.GitRepoVolumeSource{ GitRepo: &v1.GitRepoVolumeSource{
Repository: gitUrl, Repository: gitUrl,
Revision: revision, Revision: revision,
Directory: "target_dir", Directory: "target_dir",
...@@ -107,10 +107,10 @@ func TestPlugin(t *testing.T) { ...@@ -107,10 +107,10 @@ func TestPlugin(t *testing.T) {
}, },
{ {
name: "target-dir-no-revision", name: "target-dir-no-revision",
vol: &api.Volume{ vol: &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GitRepo: &api.GitRepoVolumeSource{ GitRepo: &v1.GitRepoVolumeSource{
Repository: gitUrl, Repository: gitUrl,
Directory: "target_dir", Directory: "target_dir",
}, },
...@@ -126,10 +126,10 @@ func TestPlugin(t *testing.T) { ...@@ -126,10 +126,10 @@ func TestPlugin(t *testing.T) {
}, },
{ {
name: "only-git-clone", name: "only-git-clone",
vol: &api.Volume{ vol: &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GitRepo: &api.GitRepoVolumeSource{ GitRepo: &v1.GitRepoVolumeSource{
Repository: gitUrl, Repository: gitUrl,
}, },
}, },
...@@ -144,10 +144,10 @@ func TestPlugin(t *testing.T) { ...@@ -144,10 +144,10 @@ func TestPlugin(t *testing.T) {
}, },
{ {
name: "no-target-dir", name: "no-target-dir",
vol: &api.Volume{ vol: &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GitRepo: &api.GitRepoVolumeSource{ GitRepo: &v1.GitRepoVolumeSource{
Repository: gitUrl, Repository: gitUrl,
Revision: revision, Revision: revision,
Directory: "", Directory: "",
...@@ -172,10 +172,10 @@ func TestPlugin(t *testing.T) { ...@@ -172,10 +172,10 @@ func TestPlugin(t *testing.T) {
}, },
{ {
name: "current-dir", name: "current-dir",
vol: &api.Volume{ vol: &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
GitRepo: &api.GitRepoVolumeSource{ GitRepo: &v1.GitRepoVolumeSource{
Repository: gitUrl, Repository: gitUrl,
Revision: revision, Revision: revision,
Directory: ".", Directory: ".",
...@@ -214,7 +214,7 @@ func TestPlugin(t *testing.T) { ...@@ -214,7 +214,7 @@ func TestPlugin(t *testing.T) {
func doTestPlugin(scenario struct { func doTestPlugin(scenario struct {
name string name string
vol *api.Volume vol *v1.Volume
expecteds []expectedCommand expecteds []expectedCommand
isExpectedFailure bool isExpectedFailure bool
}, t *testing.T) []error { }, t *testing.T) []error {
...@@ -231,7 +231,7 @@ func doTestPlugin(scenario struct { ...@@ -231,7 +231,7 @@ func doTestPlugin(scenario struct {
fmt.Errorf("Can't find the plugin by name")) fmt.Errorf("Can't find the plugin by name"))
return allErrs return allErrs
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{}) mounter, err := plug.NewMounter(volume.NewSpecFromVolume(scenario.vol), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
...@@ -311,7 +311,7 @@ func doTestPlugin(scenario struct { ...@@ -311,7 +311,7 @@ func doTestPlugin(scenario struct {
func doTestSetUp(scenario struct { func doTestSetUp(scenario struct {
name string name string
vol *api.Volume vol *v1.Volume
expecteds []expectedCommand expecteds []expectedCommand
isExpectedFailure bool isExpectedFailure bool
}, mounter volume.Mounter) []error { }, mounter volume.Mounter) []error {
......
...@@ -20,22 +20,22 @@ import ( ...@@ -20,22 +20,22 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"runtime"
dstrings "strings" dstrings "strings"
"github.com/golang/glog" "github.com/golang/glog"
gcli "github.com/heketi/heketi/client/api/go-client" gcli "github.com/heketi/heketi/client/api/go-client"
gapi "github.com/heketi/heketi/pkg/glusterfs/api" gapi "github.com/heketi/heketi/pkg/glusterfs/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/api/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volutil "k8s.io/kubernetes/pkg/volume/util" volutil "k8s.io/kubernetes/pkg/volume/util"
"runtime"
) )
// This is the primary entrypoint for volume plugins. // This is the primary entrypoint for volume plugins.
...@@ -104,15 +104,15 @@ func (plugin *glusterfsPlugin) RequiresRemount() bool { ...@@ -104,15 +104,15 @@ func (plugin *glusterfsPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *glusterfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *glusterfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
api.ReadWriteMany, v1.ReadWriteMany,
} }
} }
func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
source, _ := plugin.getGlusterVolumeSource(spec) source, _ := plugin.getGlusterVolumeSource(spec)
ep_name := source.EndpointsName ep_name := source.EndpointsName
// PVC/POD is in same ns. // PVC/POD is in same ns.
...@@ -126,7 +126,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ vol ...@@ -126,7 +126,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ vol
return plugin.newMounterInternal(spec, ep, pod, plugin.host.GetMounter(), exec.New()) return plugin.newMounterInternal(spec, ep, pod, plugin.host.GetMounter(), exec.New())
} }
func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*api.GlusterfsVolumeSource, bool) { func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*v1.GlusterfsVolumeSource, bool) {
// Glusterfs volumes used directly in a pod have a ReadOnly flag set by the pod author. // Glusterfs volumes used directly in a pod have a ReadOnly flag set by the pod author.
// Glusterfs volumes used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV // Glusterfs volumes used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV
if spec.Volume != nil && spec.Volume.Glusterfs != nil { if spec.Volume != nil && spec.Volume.Glusterfs != nil {
...@@ -136,7 +136,7 @@ func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*api.G ...@@ -136,7 +136,7 @@ func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*api.G
} }
} }
func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *api.Endpoints, pod *api.Pod, mounter mount.Interface, exe exec.Interface) (volume.Mounter, error) { func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endpoints, pod *v1.Pod, mounter mount.Interface, exe exec.Interface) (volume.Mounter, error) {
source, readOnly := plugin.getGlusterVolumeSource(spec) source, readOnly := plugin.getGlusterVolumeSource(spec)
return &glusterfsMounter{ return &glusterfsMounter{
glusterfs: &glusterfs{ glusterfs: &glusterfs{
...@@ -159,7 +159,7 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types ...@@ -159,7 +159,7 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types
return &glusterfsUnmounter{&glusterfs{ return &glusterfsUnmounter{&glusterfs{
volName: volName, volName: volName,
mounter: mounter, mounter: mounter,
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}}, pod: &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: podUID}},
plugin: plugin, plugin: plugin,
}}, nil }}, nil
} }
...@@ -170,10 +170,10 @@ func (plugin *glusterfsPlugin) execCommand(command string, args []string) ([]byt ...@@ -170,10 +170,10 @@ func (plugin *glusterfsPlugin) execCommand(command string, args []string) ([]byt
} }
func (plugin *glusterfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *glusterfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
glusterfsVolume := &api.Volume{ glusterfsVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{ Glusterfs: &v1.GlusterfsVolumeSource{
EndpointsName: volumeName, EndpointsName: volumeName,
Path: volumeName, Path: volumeName,
}, },
...@@ -185,7 +185,7 @@ func (plugin *glusterfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) ...@@ -185,7 +185,7 @@ func (plugin *glusterfsPlugin) ConstructVolumeSpec(volumeName, mountPath string)
// Glusterfs volumes represent a bare host file or directory mount of an Glusterfs export. // Glusterfs volumes represent a bare host file or directory mount of an Glusterfs export.
type glusterfs struct { type glusterfs struct {
volName string volName string
pod *api.Pod pod *v1.Pod
mounter mount.Interface mounter mount.Interface
plugin *glusterfsPlugin plugin *glusterfsPlugin
volume.MetricsNil volume.MetricsNil
...@@ -193,7 +193,7 @@ type glusterfs struct { ...@@ -193,7 +193,7 @@ type glusterfs struct {
type glusterfsMounter struct { type glusterfsMounter struct {
*glusterfs *glusterfs
hosts *api.Endpoints hosts *v1.Endpoints
path string path string
readOnly bool readOnly bool
exe exec.Interface exe exec.Interface
...@@ -352,7 +352,7 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error { ...@@ -352,7 +352,7 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.GlusterfsVolumeSource, bool, error) { spec *volume.Spec) (*v1.GlusterfsVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.Glusterfs != nil { if spec.Volume != nil && spec.Volume.Glusterfs != nil {
return spec.Volume.Glusterfs, spec.Volume.Glusterfs.ReadOnly, nil return spec.Volume.Glusterfs, spec.Volume.Glusterfs.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
...@@ -416,7 +416,7 @@ func (plugin *glusterfsPlugin) newDeleterInternal(spec *volume.Spec) (volume.Del ...@@ -416,7 +416,7 @@ func (plugin *glusterfsPlugin) newDeleterInternal(spec *volume.Spec) (volume.Del
type glusterfsVolumeDeleter struct { type glusterfsVolumeDeleter struct {
*glusterfsMounter *glusterfsMounter
provisioningConfig provisioningConfig
spec *api.PersistentVolume spec *v1.PersistentVolume
} }
func (d *glusterfsVolumeDeleter) GetPath() string { func (d *glusterfsVolumeDeleter) GetPath() string {
...@@ -479,7 +479,7 @@ func (d *glusterfsVolumeDeleter) Delete() error { ...@@ -479,7 +479,7 @@ func (d *glusterfsVolumeDeleter) Delete() error {
return nil return nil
} }
func (r *glusterfsVolumeProvisioner) Provision() (*api.PersistentVolume, error) { func (r *glusterfsVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
var err error var err error
if r.options.PVC.Spec.Selector != nil { if r.options.PVC.Spec.Selector != nil {
glog.V(4).Infof("glusterfs: not able to parse your claim Selector") glog.V(4).Infof("glusterfs: not able to parse your claim Selector")
...@@ -499,21 +499,21 @@ func (r *glusterfsVolumeProvisioner) Provision() (*api.PersistentVolume, error) ...@@ -499,21 +499,21 @@ func (r *glusterfsVolumeProvisioner) Provision() (*api.PersistentVolume, error)
glog.Errorf("glusterfs: create volume err: %v.", err) glog.Errorf("glusterfs: create volume err: %v.", err)
return nil, fmt.Errorf("glusterfs: create volume err: %v.", err) return nil, fmt.Errorf("glusterfs: create volume err: %v.", err)
} }
pv := new(api.PersistentVolume) pv := new(v1.PersistentVolume)
pv.Spec.PersistentVolumeSource.Glusterfs = glusterfs pv.Spec.PersistentVolumeSource.Glusterfs = glusterfs
pv.Spec.PersistentVolumeReclaimPolicy = r.options.PersistentVolumeReclaimPolicy pv.Spec.PersistentVolumeReclaimPolicy = r.options.PersistentVolumeReclaimPolicy
pv.Spec.AccessModes = r.options.PVC.Spec.AccessModes pv.Spec.AccessModes = r.options.PVC.Spec.AccessModes
if len(pv.Spec.AccessModes) == 0 { if len(pv.Spec.AccessModes) == 0 {
pv.Spec.AccessModes = r.plugin.GetAccessModes() pv.Spec.AccessModes = r.plugin.GetAccessModes()
} }
pv.Spec.Capacity = api.ResourceList{ pv.Spec.Capacity = v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
} }
return pv, nil return pv, nil
} }
func (p *glusterfsVolumeProvisioner) CreateVolume() (r *api.GlusterfsVolumeSource, size int, err error) { func (p *glusterfsVolumeProvisioner) CreateVolume() (r *v1.GlusterfsVolumeSource, size int, err error) {
capacity := p.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
volSizeBytes := capacity.Value() volSizeBytes := capacity.Value()
sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024)) sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
glog.V(2).Infof("glusterfs: create volume of size: %d bytes and configuration %+v", volSizeBytes, p.provisioningConfig) glog.V(2).Infof("glusterfs: create volume of size: %d bytes and configuration %+v", volSizeBytes, p.provisioningConfig)
...@@ -573,30 +573,30 @@ func (p *glusterfsVolumeProvisioner) CreateVolume() (r *api.GlusterfsVolumeSourc ...@@ -573,30 +573,30 @@ func (p *glusterfsVolumeProvisioner) CreateVolume() (r *api.GlusterfsVolumeSourc
return nil, 0, fmt.Errorf("failed to create endpoint/service %v", err) return nil, 0, fmt.Errorf("failed to create endpoint/service %v", err)
} }
glog.V(3).Infof("glusterfs: dynamic ep %v and svc : %v ", endpoint, service) glog.V(3).Infof("glusterfs: dynamic ep %v and svc : %v ", endpoint, service)
return &api.GlusterfsVolumeSource{ return &v1.GlusterfsVolumeSource{
EndpointsName: endpoint.Name, EndpointsName: endpoint.Name,
Path: volume.Name, Path: volume.Name,
ReadOnly: false, ReadOnly: false,
}, sz, nil }, sz, nil
} }
func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epServiceName string, hostips []string, pvcname string) (endpoint *api.Endpoints, service *api.Service, err error) { func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epServiceName string, hostips []string, pvcname string) (endpoint *v1.Endpoints, service *v1.Service, err error) {
addrlist := make([]api.EndpointAddress, len(hostips)) addrlist := make([]v1.EndpointAddress, len(hostips))
for i, v := range hostips { for i, v := range hostips {
addrlist[i].IP = v addrlist[i].IP = v
} }
endpoint = &api.Endpoints{ endpoint = &v1.Endpoints{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Namespace: namespace, Namespace: namespace,
Name: epServiceName, Name: epServiceName,
Labels: map[string]string{ Labels: map[string]string{
"gluster.kubernetes.io/provisioned-for-pvc": pvcname, "gluster.kubernetes.io/provisioned-for-pvc": pvcname,
}, },
}, },
Subsets: []api.EndpointSubset{{ Subsets: []v1.EndpointSubset{{
Addresses: addrlist, Addresses: addrlist,
Ports: []api.EndpointPort{{Port: 1, Protocol: "TCP"}}, Ports: []v1.EndpointPort{{Port: 1, Protocol: "TCP"}},
}}, }},
} }
_, err = p.plugin.host.GetKubeClient().Core().Endpoints(namespace).Create(endpoint) _, err = p.plugin.host.GetKubeClient().Core().Endpoints(namespace).Create(endpoint)
...@@ -608,16 +608,16 @@ func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epS ...@@ -608,16 +608,16 @@ func (p *glusterfsVolumeProvisioner) createEndpointService(namespace string, epS
glog.Errorf("glusterfs: failed to create endpoint %v", err) glog.Errorf("glusterfs: failed to create endpoint %v", err)
return nil, nil, fmt.Errorf("error creating endpoint %v", err) return nil, nil, fmt.Errorf("error creating endpoint %v", err)
} }
service = &api.Service{ service = &v1.Service{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: epServiceName, Name: epServiceName,
Namespace: namespace, Namespace: namespace,
Labels: map[string]string{ Labels: map[string]string{
"gluster.kubernetes.io/provisioned-for-pvc": pvcname, "gluster.kubernetes.io/provisioned-for-pvc": pvcname,
}, },
}, },
Spec: api.ServiceSpec{ Spec: v1.ServiceSpec{
Ports: []api.ServicePort{ Ports: []v1.ServicePort{
{Protocol: "TCP", Port: 1}}}} {Protocol: "TCP", Port: 1}}}}
_, err = p.plugin.host.GetKubeClient().Core().Services(namespace).Create(service) _, err = p.plugin.host.GetKubeClient().Core().Services(namespace).Create(service)
if err != nil && errors.IsAlreadyExists(err) { if err != nil && errors.IsAlreadyExists(err) {
......
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
"reflect" "reflect"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/client/testing/core" "k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/runtime" "k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
...@@ -50,10 +50,10 @@ func TestCanSupport(t *testing.T) { ...@@ -50,10 +50,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/glusterfs" { if plug.GetPluginName() != "kubernetes.io/glusterfs" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{}}}}) { if plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{}}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -72,12 +72,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -72,12 +72,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) || !contains(plug.GetAccessModes(), api.ReadWriteMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) || !contains(plug.GetAccessModes(), v1.ReadWriteMany) {
t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany) t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", v1.ReadWriteOnce, v1.ReadOnlyMany, v1.ReadWriteMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -99,8 +99,8 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -99,8 +99,8 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
ep := &api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "foo"}, Subsets: []api.EndpointSubset{{ ep := &v1.Endpoints{ObjectMeta: v1.ObjectMeta{Name: "foo"}, Subsets: []v1.EndpointSubset{{
Addresses: []api.EndpointAddress{{IP: "127.0.0.1"}}}}} Addresses: []v1.EndpointAddress{{IP: "127.0.0.1"}}}}}
var fcmd exec.FakeCmd var fcmd exec.FakeCmd
fcmd = exec.FakeCmd{ fcmd = exec.FakeCmd{
CombinedOutputScript: []exec.FakeCombinedOutputAction{ CombinedOutputScript: []exec.FakeCombinedOutputAction{
...@@ -115,7 +115,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -115,7 +115,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) },
}, },
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.(*glusterfsPlugin).newMounterInternal(spec, ep, pod, &mount.FakeMounter{}, &fake) mounter, err := plug.(*glusterfsPlugin).newMounterInternal(spec, ep, pod, &mount.FakeMounter{}, &fake)
volumePath := mounter.GetPath() volumePath := mounter.GetPath()
if err != nil { if err != nil {
...@@ -157,21 +157,21 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -157,21 +157,21 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
} }
func TestPluginVolume(t *testing.T) { func TestPluginVolume(t *testing.T) {
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false}}, VolumeSource: v1.VolumeSource{Glusterfs: &v1.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false}},
} }
doTestPlugin(t, volume.NewSpecFromVolume(vol)) doTestPlugin(t, volume.NewSpecFromVolume(vol))
} }
func TestPluginPersistentVolume(t *testing.T) { func TestPluginPersistentVolume(t *testing.T) {
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false}, Glusterfs: &v1.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false},
}, },
}, },
} }
...@@ -186,41 +186,41 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -186,41 +186,41 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false}, Glusterfs: &v1.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
ep := &api.Endpoints{ ep := &v1.Endpoints{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Namespace: "nsA", Namespace: "nsA",
Name: "ep", Name: "ep",
}, },
Subsets: []api.EndpointSubset{{ Subsets: []v1.EndpointSubset{{
Addresses: []api.EndpointAddress{{IP: "127.0.0.1"}}, Addresses: []v1.EndpointAddress{{IP: "127.0.0.1"}},
Ports: []api.EndpointPort{{Name: "foo", Port: 80, Protocol: api.ProtocolTCP}}, Ports: []v1.EndpointPort{{Name: "foo", Port: 80, Protocol: v1.ProtocolTCP}},
}}, }},
} }
...@@ -232,7 +232,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -232,7 +232,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: "nsA", UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{Namespace: "nsA", UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
...@@ -241,7 +241,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -241,7 +241,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
} }
func TestParseClassParameters(t *testing.T) { func TestParseClassParameters(t *testing.T) {
secret := api.Secret{ secret := v1.Secret{
Type: "kubernetes.io/glusterfs", Type: "kubernetes.io/glusterfs",
Data: map[string][]byte{ Data: map[string][]byte{
"data": []byte("mypassword"), "data": []byte("mypassword"),
...@@ -251,7 +251,7 @@ func TestParseClassParameters(t *testing.T) { ...@@ -251,7 +251,7 @@ func TestParseClassParameters(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
parameters map[string]string parameters map[string]string
secret *api.Secret secret *v1.Secret
expectError bool expectError bool
expectConfig *provisioningConfig expectConfig *provisioningConfig
}{ }{
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
"os" "os"
"regexp" "regexp"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/uuid" "k8s.io/kubernetes/pkg/util/uuid"
...@@ -83,13 +83,13 @@ func (plugin *hostPathPlugin) RequiresRemount() bool { ...@@ -83,13 +83,13 @@ func (plugin *hostPathPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *hostPathPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *hostPathPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
} }
} }
func (plugin *hostPathPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *hostPathPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
hostPathVolumeSource, readOnly, err := getVolumeSource(spec) hostPathVolumeSource, readOnly, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -122,10 +122,10 @@ func (plugin *hostPathPlugin) NewProvisioner(options volume.VolumeOptions) (volu ...@@ -122,10 +122,10 @@ func (plugin *hostPathPlugin) NewProvisioner(options volume.VolumeOptions) (volu
} }
func (plugin *hostPathPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *hostPathPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
hostPathVolume := &api.Volume{ hostPathVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{ HostPath: &v1.HostPathVolumeSource{
Path: volumeName, Path: volumeName,
}, },
}, },
...@@ -249,11 +249,11 @@ func (r *hostPathRecycler) Recycle() error { ...@@ -249,11 +249,11 @@ func (r *hostPathRecycler) Recycle() error {
if err != nil { if err != nil {
return err return err
} }
pod := templateClone.(*api.Pod) pod := templateClone.(*v1.Pod)
// overrides // overrides
pod.Spec.ActiveDeadlineSeconds = &r.timeout pod.Spec.ActiveDeadlineSeconds = &r.timeout
pod.Spec.Volumes[0].VolumeSource = api.VolumeSource{ pod.Spec.Volumes[0].VolumeSource = v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{ HostPath: &v1.HostPathVolumeSource{
Path: r.path, Path: r.path,
}, },
} }
...@@ -270,25 +270,25 @@ type hostPathProvisioner struct { ...@@ -270,25 +270,25 @@ type hostPathProvisioner struct {
// Create for hostPath simply creates a local /tmp/hostpath_pv/%s directory as a new PersistentVolume. // Create for hostPath simply creates a local /tmp/hostpath_pv/%s directory as a new PersistentVolume.
// This Provisioner is meant for development and testing only and WILL NOT WORK in a multi-node cluster. // This Provisioner is meant for development and testing only and WILL NOT WORK in a multi-node cluster.
func (r *hostPathProvisioner) Provision() (*api.PersistentVolume, error) { func (r *hostPathProvisioner) Provision() (*v1.PersistentVolume, error) {
fullpath := fmt.Sprintf("/tmp/hostpath_pv/%s", uuid.NewUUID()) fullpath := fmt.Sprintf("/tmp/hostpath_pv/%s", uuid.NewUUID())
capacity := r.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := r.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: r.options.PVName, Name: r.options.PVName,
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "hostpath-dynamic-provisioner", "kubernetes.io/createdby": "hostpath-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: r.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: r.options.PersistentVolumeReclaimPolicy,
AccessModes: r.options.PVC.Spec.AccessModes, AccessModes: r.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): capacity, v1.ResourceName(v1.ResourceStorage): capacity,
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{ HostPath: &v1.HostPathVolumeSource{
Path: fullpath, Path: fullpath,
}, },
}, },
...@@ -326,7 +326,7 @@ func (r *hostPathDeleter) Delete() error { ...@@ -326,7 +326,7 @@ func (r *hostPathDeleter) Delete() error {
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.HostPathVolumeSource, bool, error) { spec *volume.Spec) (*v1.HostPathVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.HostPath != nil { if spec.Volume != nil && spec.Volume.HostPath != nil {
return spec.Volume.HostPath, spec.ReadOnly, nil return spec.Volume.HostPath, spec.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -23,9 +23,9 @@ import ( ...@@ -23,9 +23,9 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/uuid" "k8s.io/kubernetes/pkg/util/uuid"
...@@ -44,13 +44,13 @@ func TestCanSupport(t *testing.T) { ...@@ -44,13 +44,13 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/host-path" { if plug.GetPluginName() != "kubernetes.io/host-path" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{HostPath: &v1.HostPathVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -63,8 +63,8 @@ func TestGetAccessModes(t *testing.T) { ...@@ -63,8 +63,8 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if len(plug.GetAccessModes()) != 1 || plug.GetAccessModes()[0] != api.ReadWriteOnce { if len(plug.GetAccessModes()) != 1 || plug.GetAccessModes()[0] != v1.ReadWriteOnce {
t.Errorf("Expected %s PersistentVolumeAccessMode", api.ReadWriteOnce) t.Errorf("Expected %s PersistentVolumeAccessMode", v1.ReadWriteOnce)
} }
} }
...@@ -73,7 +73,7 @@ func TestRecycler(t *testing.T) { ...@@ -73,7 +73,7 @@ func TestRecycler(t *testing.T) {
pluginHost := volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil) pluginHost := volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil)
plugMgr.InitPlugins([]volume.VolumePlugin{&hostPathPlugin{nil, volume.VolumeConfig{}}}, pluginHost) plugMgr.InitPlugins([]volume.VolumePlugin{&hostPathPlugin{nil, volume.VolumeConfig{}}}, pluginHost)
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/foo"}}}}} spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{Path: "/foo"}}}}}
plug, err := plugMgr.FindRecyclablePluginBySpec(spec) plug, err := plugMgr.FindRecyclablePluginBySpec(spec)
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
...@@ -99,7 +99,7 @@ func TestDeleter(t *testing.T) { ...@@ -99,7 +99,7 @@ func TestDeleter(t *testing.T) {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil)) plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: tempPath}}}}} spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{Path: tempPath}}}}}
plug, err := plugMgr.FindDeletablePluginBySpec(spec) plug, err := plugMgr.FindDeletablePluginBySpec(spec)
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
...@@ -132,7 +132,7 @@ func TestDeleterTempDir(t *testing.T) { ...@@ -132,7 +132,7 @@ func TestDeleterTempDir(t *testing.T) {
for name, test := range tests { for name, test := range tests {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil)) plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: test.path}}}}} spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{Path: test.path}}}}}
plug, _ := plugMgr.FindDeletablePluginBySpec(spec) plug, _ := plugMgr.FindDeletablePluginBySpec(spec)
deleter, _ := plug.NewDeleter(spec) deleter, _ := plug.NewDeleter(spec)
err := deleter.Delete() err := deleter.Delete()
...@@ -153,14 +153,14 @@ func TestProvisioner(t *testing.T) { ...@@ -153,14 +153,14 @@ func TestProvisioner(t *testing.T) {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{ProvisioningEnabled: true}), plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{ProvisioningEnabled: true}),
volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil)) volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: tempPath}}}}} spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{HostPath: &v1.HostPathVolumeSource{Path: tempPath}}}}}
plug, err := plugMgr.FindCreatablePluginBySpec(spec) plug, err := plugMgr.FindCreatablePluginBySpec(spec)
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: volumetest.CreateTestPVC("1Gi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}), PVC: volumetest.CreateTestPVC("1Gi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
creater, err := plug.NewProvisioner(options) creater, err := plug.NewProvisioner(options)
if err != nil { if err != nil {
...@@ -174,15 +174,15 @@ func TestProvisioner(t *testing.T) { ...@@ -174,15 +174,15 @@ func TestProvisioner(t *testing.T) {
t.Errorf("Expected pv.Spec.HostPath.Path to not be empty: %#v", pv) t.Errorf("Expected pv.Spec.HostPath.Path to not be empty: %#v", pv)
} }
expectedCapacity := resource.NewQuantity(1*1024*1024*1024, resource.BinarySI) expectedCapacity := resource.NewQuantity(1*1024*1024*1024, resource.BinarySI)
actualCapacity := pv.Spec.Capacity[api.ResourceStorage] actualCapacity := pv.Spec.Capacity[v1.ResourceStorage]
expectedAmt := expectedCapacity.Value() expectedAmt := expectedCapacity.Value()
actualAmt := actualCapacity.Value() actualAmt := actualCapacity.Value()
if expectedAmt != actualAmt { if expectedAmt != actualAmt {
t.Errorf("Expected capacity %+v but got %+v", expectedAmt, actualAmt) t.Errorf("Expected capacity %+v but got %+v", expectedAmt, actualAmt)
} }
if pv.Spec.PersistentVolumeReclaimPolicy != api.PersistentVolumeReclaimDelete { if pv.Spec.PersistentVolumeReclaimPolicy != v1.PersistentVolumeReclaimDelete {
t.Errorf("Expected reclaim policy %+v but got %+v", api.PersistentVolumeReclaimDelete, pv.Spec.PersistentVolumeReclaimPolicy) t.Errorf("Expected reclaim policy %+v but got %+v", v1.PersistentVolumeReclaimDelete, pv.Spec.PersistentVolumeReclaimPolicy)
} }
os.RemoveAll(pv.Spec.HostPath.Path) os.RemoveAll(pv.Spec.HostPath.Path)
...@@ -196,11 +196,11 @@ func TestPlugin(t *testing.T) { ...@@ -196,11 +196,11 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/vol1"}}, VolumeSource: v1.VolumeSource{HostPath: &v1.HostPathVolumeSource{Path: "/vol1"}},
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}) mounter, err := plug.NewMounter(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -232,30 +232,30 @@ func TestPlugin(t *testing.T) { ...@@ -232,30 +232,30 @@ func TestPlugin(t *testing.T) {
} }
func TestPersistentClaimReadOnlyFlag(t *testing.T) { func TestPersistentClaimReadOnlyFlag(t *testing.T) {
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "foo"}, HostPath: &v1.HostPathVolumeSource{Path: "foo"},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -267,7 +267,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -267,7 +267,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"strings" "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -82,14 +82,14 @@ func (plugin *iscsiPlugin) RequiresRemount() bool { ...@@ -82,14 +82,14 @@ func (plugin *iscsiPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *iscsiPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *iscsiPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
} }
} }
func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newMounterInternal(spec, pod.UID, &ISCSIUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &ISCSIUtil{}, plugin.host.GetMounter())
} }
...@@ -147,10 +147,10 @@ func (plugin *iscsiPlugin) execCommand(command string, args []string) ([]byte, e ...@@ -147,10 +147,10 @@ func (plugin *iscsiPlugin) execCommand(command string, args []string) ([]byte, e
} }
func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
iscsiVolume := &api.Volume{ iscsiVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
ISCSI: &api.ISCSIVolumeSource{ ISCSI: &v1.ISCSIVolumeSource{
TargetPortal: volumeName, TargetPortal: volumeName,
IQN: volumeName, IQN: volumeName,
}, },
...@@ -240,7 +240,7 @@ func portalMounter(portal string) string { ...@@ -240,7 +240,7 @@ func portalMounter(portal string) string {
return portal return portal
} }
func getVolumeSource(spec *volume.Spec) (*api.ISCSIVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.ISCSIVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.ISCSI != nil { if spec.Volume != nil && spec.Volume.ISCSI != nil {
return spec.Volume.ISCSI, spec.Volume.ISCSI.ReadOnly, nil return spec.Volume.ISCSI, spec.Volume.ISCSI.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -47,7 +47,7 @@ func TestCanSupport(t *testing.T) { ...@@ -47,7 +47,7 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/iscsi" { if plug.GetPluginName() != "kubernetes.io/iscsi" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -66,12 +66,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -66,12 +66,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) {
t.Errorf("Expected two AccessModeTypes: %s and %s", api.ReadWriteOnce, api.ReadOnlyMany) t.Errorf("Expected two AccessModeTypes: %s and %s", v1.ReadWriteOnce, v1.ReadOnlyMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -199,10 +199,10 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -199,10 +199,10 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
} }
func TestPluginVolume(t *testing.T) { func TestPluginVolume(t *testing.T) {
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
ISCSI: &api.ISCSIVolumeSource{ ISCSI: &v1.ISCSIVolumeSource{
TargetPortal: "127.0.0.1:3260", TargetPortal: "127.0.0.1:3260",
IQN: "iqn.2014-12.server:storage.target01", IQN: "iqn.2014-12.server:storage.target01",
FSType: "ext4", FSType: "ext4",
...@@ -214,13 +214,13 @@ func TestPluginVolume(t *testing.T) { ...@@ -214,13 +214,13 @@ func TestPluginVolume(t *testing.T) {
} }
func TestPluginPersistentVolume(t *testing.T) { func TestPluginPersistentVolume(t *testing.T) {
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
ISCSI: &api.ISCSIVolumeSource{ ISCSI: &v1.ISCSIVolumeSource{
TargetPortal: "127.0.0.1:3260", TargetPortal: "127.0.0.1:3260",
IQN: "iqn.2014-12.server:storage.target01", IQN: "iqn.2014-12.server:storage.target01",
FSType: "ext4", FSType: "ext4",
...@@ -239,35 +239,35 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -239,35 +239,35 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
ISCSI: &api.ISCSIVolumeSource{ ISCSI: &v1.ISCSIVolumeSource{
TargetPortal: "127.0.0.1:3260", TargetPortal: "127.0.0.1:3260",
IQN: "iqn.2014-12.server:storage.target01", IQN: "iqn.2014-12.server:storage.target01",
FSType: "ext4", FSType: "ext4",
Lun: 0, Lun: 0,
}, },
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -279,7 +279,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -279,7 +279,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"runtime" "runtime"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/conversion" "k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
...@@ -87,19 +87,19 @@ func (plugin *nfsPlugin) RequiresRemount() bool { ...@@ -87,19 +87,19 @@ func (plugin *nfsPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *nfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *nfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
api.ReadWriteMany, 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()) 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) source, readOnly, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -126,7 +126,7 @@ func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID, ...@@ -126,7 +126,7 @@ func (plugin *nfsPlugin) newUnmounterInternal(volName string, podUID types.UID,
return &nfsUnmounter{&nfs{ return &nfsUnmounter{&nfs{
volName: volName, volName: volName,
mounter: mounter, mounter: mounter,
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}}, pod: &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: podUID}},
plugin: plugin, plugin: plugin,
}}, nil }}, nil
} }
...@@ -136,10 +136,10 @@ func (plugin *nfsPlugin) NewRecycler(pvName string, spec *volume.Spec, eventReco ...@@ -136,10 +136,10 @@ func (plugin *nfsPlugin) NewRecycler(pvName string, spec *volume.Spec, eventReco
} }
func (plugin *nfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *nfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
nfsVolume := &api.Volume{ nfsVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
NFS: &api.NFSVolumeSource{ NFS: &v1.NFSVolumeSource{
Path: volumeName, Path: volumeName,
}, },
}, },
...@@ -150,7 +150,7 @@ func (plugin *nfsPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*vol ...@@ -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. // NFS volumes represent a bare host file or directory mount of an NFS export.
type nfs struct { type nfs struct {
volName string volName string
pod *api.Pod pod *v1.Pod
mounter mount.Interface mounter mount.Interface
plugin *nfsPlugin plugin *nfsPlugin
volume.MetricsNil volume.MetricsNil
...@@ -337,12 +337,12 @@ func (r *nfsRecycler) Recycle() error { ...@@ -337,12 +337,12 @@ func (r *nfsRecycler) Recycle() error {
if err != nil { if err != nil {
return err return err
} }
pod := templateClone.(*api.Pod) pod := templateClone.(*v1.Pod)
// overrides // overrides
pod.Spec.ActiveDeadlineSeconds = &r.timeout pod.Spec.ActiveDeadlineSeconds = &r.timeout
pod.GenerateName = "pv-recycler-nfs-" pod.GenerateName = "pv-recycler-nfs-"
pod.Spec.Volumes[0].VolumeSource = api.VolumeSource{ pod.Spec.Volumes[0].VolumeSource = v1.VolumeSource{
NFS: &api.NFSVolumeSource{ NFS: &v1.NFSVolumeSource{
Server: r.server, Server: r.server,
Path: r.path, Path: r.path,
}, },
...@@ -350,7 +350,7 @@ func (r *nfsRecycler) Recycle() error { ...@@ -350,7 +350,7 @@ func (r *nfsRecycler) Recycle() error {
return volume.RecycleVolumeByWatchingPodUntilCompletion(r.pvName, pod, r.host.GetKubeClient(), r.eventRecorder) 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 { if spec.Volume != nil && spec.Volume.NFS != nil {
return spec.Volume.NFS, spec.Volume.NFS.ReadOnly, nil return spec.Volume.NFS, spec.Volume.NFS.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -47,13 +47,13 @@ func TestCanSupport(t *testing.T) { ...@@ -47,13 +47,13 @@ func TestCanSupport(t *testing.T) {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{NFS: &api.NFSVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{NFS: &v1.NFSVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{NFS: &api.NFSVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{NFS: &v1.NFSVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -72,8 +72,8 @@ func TestGetAccessModes(t *testing.T) { ...@@ -72,8 +72,8 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) || !contains(plug.GetAccessModes(), api.ReadWriteMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) || !contains(plug.GetAccessModes(), v1.ReadWriteMany) {
t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany) t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", v1.ReadWriteOnce, v1.ReadOnlyMany, v1.ReadWriteMany)
} }
} }
...@@ -87,7 +87,7 @@ func TestRecycler(t *testing.T) { ...@@ -87,7 +87,7 @@ func TestRecycler(t *testing.T) {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins([]volume.VolumePlugin{&nfsPlugin{nil, volume.VolumeConfig{}}}, volumetest.NewFakeVolumeHost(tmpDir, nil, nil)) plugMgr.InitPlugins([]volume.VolumePlugin{&nfsPlugin{nil, volume.VolumeConfig{}}}, volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{NFS: &api.NFSVolumeSource{Path: "/foo"}}}}} spec := &volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{NFS: &v1.NFSVolumeSource{Path: "/foo"}}}}}
plug, err := plugMgr.FindRecyclablePluginBySpec(spec) plug, err := plugMgr.FindRecyclablePluginBySpec(spec)
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
...@@ -116,7 +116,7 @@ func (r *mockRecycler) Recycle() error { ...@@ -116,7 +116,7 @@ func (r *mockRecycler) Recycle() error {
return nil return nil
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -139,7 +139,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -139,7 +139,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
fake := &mount.FakeMounter{} fake := &mount.FakeMounter{}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.(*nfsPlugin).newMounterInternal(spec, pod, fake) mounter, err := plug.(*nfsPlugin).newMounterInternal(spec, pod, fake)
volumePath := mounter.GetPath() volumePath := mounter.GetPath()
if err != nil { if err != nil {
...@@ -202,21 +202,21 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -202,21 +202,21 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
} }
func TestPluginVolume(t *testing.T) { func TestPluginVolume(t *testing.T) {
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{NFS: &api.NFSVolumeSource{Server: "localhost", Path: "/somepath", ReadOnly: false}}, VolumeSource: v1.VolumeSource{NFS: &v1.NFSVolumeSource{Server: "localhost", Path: "/somepath", ReadOnly: false}},
} }
doTestPlugin(t, volume.NewSpecFromVolume(vol)) doTestPlugin(t, volume.NewSpecFromVolume(vol))
} }
func TestPluginPersistentVolume(t *testing.T) { func TestPluginPersistentVolume(t *testing.T) {
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
NFS: &api.NFSVolumeSource{Server: "localhost", Path: "/somepath", ReadOnly: false}, NFS: &v1.NFSVolumeSource{Server: "localhost", Path: "/somepath", ReadOnly: false},
}, },
}, },
} }
...@@ -231,30 +231,30 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -231,30 +231,30 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
NFS: &api.NFSVolumeSource{}, NFS: &v1.NFSVolumeSource{},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -266,7 +266,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -266,7 +266,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"errors" "errors"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider/providers/photon" "k8s.io/kubernetes/pkg/cloudprovider/providers/photon"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing" volumetest "k8s.io/kubernetes/pkg/volume/testing"
...@@ -187,9 +187,9 @@ func newDetacher(testcase *testcase) *photonPersistentDiskDetacher { ...@@ -187,9 +187,9 @@ func newDetacher(testcase *testcase) *photonPersistentDiskDetacher {
func createVolSpec(name string, readOnly bool) *volume.Spec { func createVolSpec(name string, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
Volume: &api.Volume{ Volume: &v1.Volume{
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{ PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
PdID: name, PdID: name,
}, },
}, },
...@@ -199,10 +199,10 @@ func createVolSpec(name string, readOnly bool) *volume.Spec { ...@@ -199,10 +199,10 @@ func createVolSpec(name string, readOnly bool) *volume.Spec {
func createPVSpec(name string, readOnly bool) *volume.Spec { func createPVSpec(name string, readOnly bool) *volume.Spec {
return &volume.Spec{ return &volume.Spec{
PersistentVolume: &api.PersistentVolume{ PersistentVolume: &v1.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{ PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
PdID: name, PdID: name,
}, },
}, },
......
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
"path" "path"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -77,7 +77,7 @@ func (plugin *photonPersistentDiskPlugin) RequiresRemount() bool { ...@@ -77,7 +77,7 @@ func (plugin *photonPersistentDiskPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *photonPersistentDiskPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *photonPersistentDiskPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod.UID, &PhotonDiskUtil{}, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod.UID, &PhotonDiskUtil{}, plugin.host.GetMounter())
} }
...@@ -120,10 +120,10 @@ func (plugin *photonPersistentDiskPlugin) newUnmounterInternal(volName string, p ...@@ -120,10 +120,10 @@ func (plugin *photonPersistentDiskPlugin) newUnmounterInternal(volName string, p
} }
func (plugin *photonPersistentDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *photonPersistentDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
photonPersistentDisk := &api.Volume{ photonPersistentDisk := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{ PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
PdID: volumeName, PdID: volumeName,
}, },
}, },
...@@ -292,9 +292,9 @@ func (ppd *photonPersistentDisk) GetPath() string { ...@@ -292,9 +292,9 @@ func (ppd *photonPersistentDisk) GetPath() string {
} }
// TODO: supporting more access mode for PhotonController persistent disk // TODO: supporting more access mode for PhotonController persistent disk
func (plugin *photonPersistentDiskPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *photonPersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
} }
} }
...@@ -346,28 +346,28 @@ func (plugin *photonPersistentDiskPlugin) newProvisionerInternal(options volume. ...@@ -346,28 +346,28 @@ func (plugin *photonPersistentDiskPlugin) newProvisionerInternal(options volume.
}, nil }, nil
} }
func (p *photonPersistentDiskProvisioner) Provision() (*api.PersistentVolume, error) { func (p *photonPersistentDiskProvisioner) Provision() (*v1.PersistentVolume, error) {
pdID, sizeGB, err := p.manager.CreateVolume(p) pdID, sizeGB, err := p.manager.CreateVolume(p)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: p.options.PVName, Name: p.options.PVName,
Labels: map[string]string{}, Labels: map[string]string{},
Annotations: map[string]string{ Annotations: map[string]string{
"kubernetes.io/createdby": "photon-volume-dynamic-provisioner", "kubernetes.io/createdby": "photon-volume-dynamic-provisioner",
}, },
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeReclaimPolicy: p.options.PersistentVolumeReclaimPolicy, PersistentVolumeReclaimPolicy: p.options.PersistentVolumeReclaimPolicy,
AccessModes: p.options.PVC.Spec.AccessModes, AccessModes: p.options.PVC.Spec.AccessModes,
Capacity: api.ResourceList{ Capacity: v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
}, },
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{ PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
PdID: pdID, PdID: pdID,
FSType: "ext4", FSType: "ext4",
}, },
...@@ -382,7 +382,7 @@ func (p *photonPersistentDiskProvisioner) Provision() (*api.PersistentVolume, er ...@@ -382,7 +382,7 @@ func (p *photonPersistentDiskProvisioner) Provision() (*api.PersistentVolume, er
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.PhotonPersistentDiskVolumeSource, bool, error) { spec *volume.Spec) (*v1.PhotonPersistentDiskVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.PhotonPersistentDisk != nil { if spec.Volume != nil && spec.Volume.PhotonPersistentDisk != nil {
return spec.Volume.PhotonPersistentDisk, spec.ReadOnly, nil return spec.Volume.PhotonPersistentDisk, spec.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"path" "path"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -46,10 +46,10 @@ func TestCanSupport(t *testing.T) { ...@@ -46,10 +46,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/photon-pd" { if plug.GetPluginName() != "kubernetes.io/photon-pd" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if !plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{}}}}) { if !plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if !plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{}}}}}) { if !plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{}}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
...@@ -68,15 +68,15 @@ func TestGetAccessModes(t *testing.T) { ...@@ -68,15 +68,15 @@ func TestGetAccessModes(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) {
t.Errorf("Expected to support AccessModeTypes: %s", api.ReadWriteOnce) t.Errorf("Expected to support AccessModeTypes: %s", v1.ReadWriteOnce)
} }
if contains(plug.GetAccessModes(), api.ReadOnlyMany) { if contains(plug.GetAccessModes(), v1.ReadOnlyMany) {
t.Errorf("Expected not to support AccessModeTypes: %s", api.ReadOnlyMany) t.Errorf("Expected not to support AccessModeTypes: %s", v1.ReadOnlyMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -112,10 +112,10 @@ func TestPlugin(t *testing.T) { ...@@ -112,10 +112,10 @@ func TestPlugin(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{ PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
PdID: "pdid", PdID: "pdid",
FSType: "ext4", FSType: "ext4",
}, },
...@@ -175,8 +175,8 @@ func TestPlugin(t *testing.T) { ...@@ -175,8 +175,8 @@ func TestPlugin(t *testing.T) {
// Test Provisioner // Test Provisioner
options := volume.VolumeOptions{ options := volume.VolumeOptions{
PVC: volumetest.CreateTestPVC("10Gi", []api.PersistentVolumeAccessMode{api.ReadWriteOnce}), PVC: volumetest.CreateTestPVC("10Gi", []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}),
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimDelete, PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
} }
provisioner, err := plug.(*photonPersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{}) provisioner, err := plug.(*photonPersistentDiskPlugin).newProvisionerInternal(options, &fakePDManager{})
persistentSpec, err := provisioner.Provision() persistentSpec, err := provisioner.Provision()
...@@ -187,7 +187,7 @@ func TestPlugin(t *testing.T) { ...@@ -187,7 +187,7 @@ func TestPlugin(t *testing.T) {
if persistentSpec.Spec.PersistentVolumeSource.PhotonPersistentDisk.PdID != "test-photon-pd-id" { if persistentSpec.Spec.PersistentVolumeSource.PhotonPersistentDisk.PdID != "test-photon-pd-id" {
t.Errorf("Provision() returned unexpected persistent disk ID: %s", persistentSpec.Spec.PersistentVolumeSource.PhotonPersistentDisk.PdID) t.Errorf("Provision() returned unexpected persistent disk ID: %s", persistentSpec.Spec.PersistentVolumeSource.PhotonPersistentDisk.PdID)
} }
cap := persistentSpec.Spec.Capacity[api.ResourceStorage] cap := persistentSpec.Spec.Capacity[v1.ResourceStorage]
size := cap.Value() size := cap.Value()
if size != 10*1024*1024*1024 { if size != 10*1024*1024*1024 {
t.Errorf("Provision() returned unexpected volume size: %v", size) t.Errorf("Provision() returned unexpected volume size: %v", size)
...@@ -217,10 +217,10 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) { ...@@ -217,10 +217,10 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
spec := &api.Volume{ spec := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
PhotonPersistentDisk: &api.PhotonPersistentDiskVolumeSource{ PhotonPersistentDisk: &v1.PhotonPersistentDiskVolumeSource{
PdID: "pdid", PdID: "pdid",
FSType: "ext4", FSType: "ext4",
}, },
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/photon" "k8s.io/kubernetes/pkg/cloudprovider/providers/photon"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
...@@ -87,7 +87,7 @@ func (util *PhotonDiskUtil) CreateVolume(p *photonPersistentDiskProvisioner) (pd ...@@ -87,7 +87,7 @@ func (util *PhotonDiskUtil) CreateVolume(p *photonPersistentDiskProvisioner) (pd
return "", 0, err return "", 0, err
} }
capacity := p.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
volSizeBytes := capacity.Value() volSizeBytes := capacity.Value()
// PhotonController works with GB, convert to GB with rounding up // PhotonController works with GB, convert to GB with rounding up
volSizeGB := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024)) volSizeGB := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
......
...@@ -23,8 +23,8 @@ import ( ...@@ -23,8 +23,8 @@ import (
"sync" "sync"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
utilerrors "k8s.io/kubernetes/pkg/util/errors" utilerrors "k8s.io/kubernetes/pkg/util/errors"
...@@ -40,7 +40,7 @@ type VolumeOptions struct { ...@@ -40,7 +40,7 @@ type VolumeOptions struct {
// many kinds of provisioners. // many kinds of provisioners.
// Reclamation policy for a persistent volume // Reclamation policy for a persistent volume
PersistentVolumeReclaimPolicy api.PersistentVolumeReclaimPolicy PersistentVolumeReclaimPolicy v1.PersistentVolumeReclaimPolicy
// PV.Name of the appropriate PersistentVolume. Used to generate cloud // PV.Name of the appropriate PersistentVolume. Used to generate cloud
// volume name. // volume name.
PVName string PVName string
...@@ -48,7 +48,7 @@ type VolumeOptions struct { ...@@ -48,7 +48,7 @@ type VolumeOptions struct {
// Provisioners *must* create a PV that would be matched by this PVC, // Provisioners *must* create a PV that would be matched by this PVC,
// i.e. with required capacity, accessMode, labels matching PVC.Selector and // i.e. with required capacity, accessMode, labels matching PVC.Selector and
// so on. // so on.
PVC *api.PersistentVolumeClaim PVC *v1.PersistentVolumeClaim
// Unique name of Kubernetes cluster. // Unique name of Kubernetes cluster.
ClusterName string ClusterName string
// Tags to attach to the real volume in the cloud provider - e.g. AWS EBS // Tags to attach to the real volume in the cloud provider - e.g. AWS EBS
...@@ -90,12 +90,12 @@ type VolumePlugin interface { ...@@ -90,12 +90,12 @@ type VolumePlugin interface {
// NewMounter creates a new volume.Mounter from an API specification. // NewMounter creates a new volume.Mounter from an API specification.
// Ownership of the spec pointer in *not* transferred. // Ownership of the spec pointer in *not* transferred.
// - spec: The api.Volume spec // - spec: The v1.Volume spec
// - pod: The enclosing pod // - pod: The enclosing pod
NewMounter(spec *Spec, podRef *api.Pod, opts VolumeOptions) (Mounter, error) NewMounter(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (Mounter, error)
// NewUnmounter creates a new volume.Unmounter from recoverable state. // NewUnmounter creates a new volume.Unmounter from recoverable state.
// - name: The volume name, as per the api.Volume spec. // - name: The volume name, as per the v1.Volume spec.
// - podUID: The UID of the enclosing pod // - podUID: The UID of the enclosing pod
NewUnmounter(name string, podUID types.UID) (Unmounter, error) NewUnmounter(name string, podUID types.UID) (Unmounter, error)
...@@ -111,7 +111,7 @@ type VolumePlugin interface { ...@@ -111,7 +111,7 @@ type VolumePlugin interface {
type PersistentVolumePlugin interface { type PersistentVolumePlugin interface {
VolumePlugin VolumePlugin
// GetAccessModes describes the ways a given volume can be accessed/mounted. // GetAccessModes describes the ways a given volume can be accessed/mounted.
GetAccessModes() []api.PersistentVolumeAccessMode GetAccessModes() []v1.PersistentVolumeAccessMode
} }
// RecyclableVolumePlugin is an extended interface of VolumePlugin and is used // RecyclableVolumePlugin is an extended interface of VolumePlugin and is used
...@@ -190,7 +190,7 @@ type VolumeHost interface { ...@@ -190,7 +190,7 @@ type VolumeHost interface {
// the provided spec. This is used to implement volume plugins which // the provided spec. This is used to implement volume plugins which
// "wrap" other plugins. For example, the "secret" volume is // "wrap" other plugins. For example, the "secret" volume is
// implemented in terms of the "emptyDir" volume. // implemented in terms of the "emptyDir" volume.
NewWrapperMounter(volName string, spec Spec, pod *api.Pod, opts VolumeOptions) (Mounter, error) NewWrapperMounter(volName string, spec Spec, pod *v1.Pod, opts VolumeOptions) (Mounter, error)
// NewWrapperUnmounter finds an appropriate plugin with which to handle // NewWrapperUnmounter finds an appropriate plugin with which to handle
// the provided spec. See comments on NewWrapperMounter for more // the provided spec. See comments on NewWrapperMounter for more
...@@ -213,7 +213,7 @@ type VolumeHost interface { ...@@ -213,7 +213,7 @@ type VolumeHost interface {
GetHostIP() (net.IP, error) GetHostIP() (net.IP, error)
// Returns node allocatable // Returns node allocatable
GetNodeAllocatable() (api.ResourceList, error) GetNodeAllocatable() (v1.ResourceList, error)
} }
// VolumePluginMgr tracks registered plugins. // VolumePluginMgr tracks registered plugins.
...@@ -224,8 +224,8 @@ type VolumePluginMgr struct { ...@@ -224,8 +224,8 @@ type VolumePluginMgr struct {
// Spec is an internal representation of a volume. All API volume types translate to Spec. // Spec is an internal representation of a volume. All API volume types translate to Spec.
type Spec struct { type Spec struct {
Volume *api.Volume Volume *v1.Volume
PersistentVolume *api.PersistentVolume PersistentVolume *v1.PersistentVolume
ReadOnly bool ReadOnly bool
} }
...@@ -269,7 +269,7 @@ type VolumeConfig struct { ...@@ -269,7 +269,7 @@ type VolumeConfig struct {
// which override specific properties of the pod in accordance with that // which override specific properties of the pod in accordance with that
// plugin. See NewPersistentVolumeRecyclerPodTemplate for the properties // plugin. See NewPersistentVolumeRecyclerPodTemplate for the properties
// that are expected to be overridden. // that are expected to be overridden.
RecyclerPodTemplate *api.Pod RecyclerPodTemplate *v1.Pod
// RecyclerMinimumTimeout is the minimum amount of time in seconds for the // RecyclerMinimumTimeout is the minimum amount of time in seconds for the
// recycler pod's ActiveDeadlineSeconds attribute. Added to the minimum // recycler pod's ActiveDeadlineSeconds attribute. Added to the minimum
...@@ -296,15 +296,15 @@ type VolumeConfig struct { ...@@ -296,15 +296,15 @@ type VolumeConfig struct {
ProvisioningEnabled bool ProvisioningEnabled bool
} }
// NewSpecFromVolume creates an Spec from an api.Volume // NewSpecFromVolume creates an Spec from an v1.Volume
func NewSpecFromVolume(vs *api.Volume) *Spec { func NewSpecFromVolume(vs *v1.Volume) *Spec {
return &Spec{ return &Spec{
Volume: vs, Volume: vs,
} }
} }
// NewSpecFromPersistentVolume creates an Spec from an api.PersistentVolume // NewSpecFromPersistentVolume creates an Spec from an v1.PersistentVolume
func NewSpecFromPersistentVolume(pv *api.PersistentVolume, readOnly bool) *Spec { func NewSpecFromPersistentVolume(pv *v1.PersistentVolume, readOnly bool) *Spec {
return &Spec{ return &Spec{
PersistentVolume: pv, PersistentVolume: pv,
ReadOnly: readOnly, ReadOnly: readOnly,
...@@ -526,32 +526,32 @@ func (pm *VolumePluginMgr) FindAttachablePluginByName(name string) (AttachableVo ...@@ -526,32 +526,32 @@ func (pm *VolumePluginMgr) FindAttachablePluginByName(name string) (AttachableVo
// before failing. Recommended. Default is 60 seconds. // before failing. Recommended. Default is 60 seconds.
// //
// See HostPath and NFS for working recycler examples // See HostPath and NFS for working recycler examples
func NewPersistentVolumeRecyclerPodTemplate() *api.Pod { func NewPersistentVolumeRecyclerPodTemplate() *v1.Pod {
timeout := int64(60) timeout := int64(60)
pod := &api.Pod{ pod := &v1.Pod{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
GenerateName: "pv-recycler-", GenerateName: "pv-recycler-",
Namespace: api.NamespaceDefault, Namespace: v1.NamespaceDefault,
}, },
Spec: api.PodSpec{ Spec: v1.PodSpec{
ActiveDeadlineSeconds: &timeout, ActiveDeadlineSeconds: &timeout,
RestartPolicy: api.RestartPolicyNever, RestartPolicy: v1.RestartPolicyNever,
Volumes: []api.Volume{ Volumes: []v1.Volume{
{ {
Name: "vol", Name: "vol",
// IMPORTANT! All plugins using this template MUST // IMPORTANT! All plugins using this template MUST
// override pod.Spec.Volumes[0].VolumeSource Recycler // override pod.Spec.Volumes[0].VolumeSource Recycler
// implementations without a valid VolumeSource will fail. // implementations without a valid VolumeSource will fail.
VolumeSource: api.VolumeSource{}, VolumeSource: v1.VolumeSource{},
}, },
}, },
Containers: []api.Container{ Containers: []v1.Container{
{ {
Name: "pv-recycler", Name: "pv-recycler",
Image: "gcr.io/google_containers/busybox", Image: "gcr.io/google_containers/busybox",
Command: []string{"/bin/sh"}, Command: []string{"/bin/sh"},
Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z \"$(ls -A /scrub)\" || exit 1"}, Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z \"$(ls -A /scrub)\" || exit 1"},
VolumeMounts: []api.VolumeMount{ VolumeMounts: []v1.VolumeMount{
{ {
Name: "vol", Name: "vol",
MountPath: "/scrub", MountPath: "/scrub",
......
...@@ -19,13 +19,13 @@ package volume ...@@ -19,13 +19,13 @@ package volume
import ( import (
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
) )
func TestSpecSourceConverters(t *testing.T) { func TestSpecSourceConverters(t *testing.T) {
v := &api.Volume{ v := &v1.Volume{
Name: "foo", Name: "foo",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}, VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
} }
converted := NewSpecFromVolume(v) converted := NewSpecFromVolume(v)
...@@ -36,10 +36,10 @@ func TestSpecSourceConverters(t *testing.T) { ...@@ -36,10 +36,10 @@ func TestSpecSourceConverters(t *testing.T) {
t.Errorf("Expected %v but got %v", v.Name, converted.Name()) t.Errorf("Expected %v but got %v", v.Name, converted.Name())
} }
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{Name: "bar"}, ObjectMeta: v1.ObjectMeta{Name: "bar"},
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}, PersistentVolumeSource: v1.PersistentVolumeSource{AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{}},
}, },
} }
......
...@@ -24,8 +24,8 @@ import ( ...@@ -24,8 +24,8 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"github.com/pborman/uuid" "github.com/pborman/uuid"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -117,15 +117,15 @@ func (plugin *quobytePlugin) RequiresRemount() bool { ...@@ -117,15 +117,15 @@ func (plugin *quobytePlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *quobytePlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *quobytePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
api.ReadWriteMany, v1.ReadWriteMany,
} }
} }
func getVolumeSource(spec *volume.Spec) (*api.QuobyteVolumeSource, bool, error) { func getVolumeSource(spec *volume.Spec) (*v1.QuobyteVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.Quobyte != nil { if spec.Volume != nil && spec.Volume.Quobyte != nil {
return spec.Volume.Quobyte, spec.Volume.Quobyte.ReadOnly, nil return spec.Volume.Quobyte, spec.Volume.Quobyte.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
...@@ -137,10 +137,10 @@ func getVolumeSource(spec *volume.Spec) (*api.QuobyteVolumeSource, bool, error) ...@@ -137,10 +137,10 @@ func getVolumeSource(spec *volume.Spec) (*api.QuobyteVolumeSource, bool, error)
} }
func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
quobyteVolume := &api.Volume{ quobyteVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Quobyte: &api.QuobyteVolumeSource{ Quobyte: &v1.QuobyteVolumeSource{
Volume: volumeName, Volume: volumeName,
}, },
}, },
...@@ -148,11 +148,11 @@ func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) ( ...@@ -148,11 +148,11 @@ func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) (
return volume.NewSpecFromVolume(quobyteVolume), nil return volume.NewSpecFromVolume(quobyteVolume), nil
} }
func (plugin *quobytePlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *quobytePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter()) return plugin.newMounterInternal(spec, pod, plugin.host.GetMounter())
} }
func (plugin *quobytePlugin) newMounterInternal(spec *volume.Spec, pod *api.Pod, mounter mount.Interface) (volume.Mounter, error) { func (plugin *quobytePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, mounter mount.Interface) (volume.Mounter, error) {
source, readOnly, err := getVolumeSource(spec) source, readOnly, err := getVolumeSource(spec)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -182,7 +182,7 @@ func (plugin *quobytePlugin) newUnmounterInternal(volName string, podUID types.U ...@@ -182,7 +182,7 @@ func (plugin *quobytePlugin) newUnmounterInternal(volName string, podUID types.U
&quobyte{ &quobyte{
volName: volName, volName: volName,
mounter: mounter, mounter: mounter,
pod: &api.Pod{ObjectMeta: api.ObjectMeta{UID: podUID}}, pod: &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: podUID}},
plugin: plugin, plugin: plugin,
}, },
}, nil }, nil
...@@ -191,7 +191,7 @@ func (plugin *quobytePlugin) newUnmounterInternal(volName string, podUID types.U ...@@ -191,7 +191,7 @@ func (plugin *quobytePlugin) newUnmounterInternal(volName string, podUID types.U
// Quobyte volumes represent a bare host directory mount of an quobyte export. // Quobyte volumes represent a bare host directory mount of an quobyte export.
type quobyte struct { type quobyte struct {
volName string volName string
pod *api.Pod pod *v1.Pod
user string user string
group string group string
volume string volume string
...@@ -293,7 +293,7 @@ func (unmounter *quobyteUnmounter) TearDownAt(dir string) error { ...@@ -293,7 +293,7 @@ func (unmounter *quobyteUnmounter) TearDownAt(dir string) error {
type quobyteVolumeDeleter struct { type quobyteVolumeDeleter struct {
*quobyteMounter *quobyteMounter
pv *api.PersistentVolume pv *v1.PersistentVolume
} }
func (plugin *quobytePlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) { func (plugin *quobytePlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) {
...@@ -346,7 +346,7 @@ type quobyteVolumeProvisioner struct { ...@@ -346,7 +346,7 @@ type quobyteVolumeProvisioner struct {
options volume.VolumeOptions options volume.VolumeOptions
} }
func (provisioner *quobyteVolumeProvisioner) Provision() (*api.PersistentVolume, error) { func (provisioner *quobyteVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
if provisioner.options.PVC.Spec.Selector != nil { if provisioner.options.PVC.Spec.Selector != nil {
return nil, fmt.Errorf("claim Selector is not supported") return nil, fmt.Errorf("claim Selector is not supported")
} }
...@@ -393,15 +393,15 @@ func (provisioner *quobyteVolumeProvisioner) Provision() (*api.PersistentVolume, ...@@ -393,15 +393,15 @@ func (provisioner *quobyteVolumeProvisioner) Provision() (*api.PersistentVolume,
if err != nil { if err != nil {
return nil, err return nil, err
} }
pv := new(api.PersistentVolume) pv := new(v1.PersistentVolume)
pv.Spec.PersistentVolumeSource.Quobyte = vol pv.Spec.PersistentVolumeSource.Quobyte = vol
pv.Spec.PersistentVolumeReclaimPolicy = provisioner.options.PersistentVolumeReclaimPolicy pv.Spec.PersistentVolumeReclaimPolicy = provisioner.options.PersistentVolumeReclaimPolicy
pv.Spec.AccessModes = provisioner.options.PVC.Spec.AccessModes pv.Spec.AccessModes = provisioner.options.PVC.Spec.AccessModes
if len(pv.Spec.AccessModes) == 0 { if len(pv.Spec.AccessModes) == 0 {
pv.Spec.AccessModes = provisioner.plugin.GetAccessModes() pv.Spec.AccessModes = provisioner.plugin.GetAccessModes()
} }
pv.Spec.Capacity = api.ResourceList{ pv.Spec.Capacity = v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
} }
return pv, nil return pv, nil
} }
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -46,10 +46,10 @@ func TestCanSupport(t *testing.T) { ...@@ -46,10 +46,10 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/quobyte" { if plug.GetPluginName() != "kubernetes.io/quobyte" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if plug.CanSupport(&volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{}}}}) { if plug.CanSupport(&volume.Spec{PersistentVolume: &v1.PersistentVolume{Spec: v1.PersistentVolumeSpec{PersistentVolumeSource: v1.PersistentVolumeSource{}}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -68,12 +68,12 @@ func TestGetAccessModes(t *testing.T) { ...@@ -68,12 +68,12 @@ func TestGetAccessModes(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) || !contains(plug.GetAccessModes(), api.ReadWriteMany) { if !contains(plug.GetAccessModes(), v1.ReadWriteOnce) || !contains(plug.GetAccessModes(), v1.ReadOnlyMany) || !contains(plug.GetAccessModes(), v1.ReadWriteMany) {
t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany) t.Errorf("Expected three AccessModeTypes: %s, %s, and %s", v1.ReadWriteOnce, v1.ReadOnlyMany, v1.ReadWriteMany)
} }
} }
func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool { func contains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
...@@ -96,7 +96,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -96,7 +96,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.(*quobytePlugin).newMounterInternal(spec, pod, &mount.FakeMounter{}) mounter, err := plug.(*quobytePlugin).newMounterInternal(spec, pod, &mount.FakeMounter{})
volumePath := mounter.GetPath() volumePath := mounter.GetPath()
if err != nil { if err != nil {
...@@ -126,23 +126,23 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -126,23 +126,23 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
} }
func TestPluginVolume(t *testing.T) { func TestPluginVolume(t *testing.T) {
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Quobyte: &api.QuobyteVolumeSource{Registry: "reg:7861", Volume: "vol", ReadOnly: false, User: "root", Group: "root"}, Quobyte: &v1.QuobyteVolumeSource{Registry: "reg:7861", Volume: "vol", ReadOnly: false, User: "root", Group: "root"},
}, },
} }
doTestPlugin(t, volume.NewSpecFromVolume(vol)) doTestPlugin(t, volume.NewSpecFromVolume(vol))
} }
func TestPluginPersistentVolume(t *testing.T) { func TestPluginPersistentVolume(t *testing.T) {
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Quobyte: &api.QuobyteVolumeSource{Registry: "reg:7861", Volume: "vol", ReadOnly: false, User: "root", Group: "root"}, Quobyte: &v1.QuobyteVolumeSource{Registry: "reg:7861", Volume: "vol", ReadOnly: false, User: "root", Group: "root"},
}, },
}, },
} }
...@@ -151,30 +151,30 @@ func TestPluginPersistentVolume(t *testing.T) { ...@@ -151,30 +151,30 @@ func TestPluginPersistentVolume(t *testing.T) {
} }
func TestPersistentClaimReadOnlyFlag(t *testing.T) { func TestPersistentClaimReadOnlyFlag(t *testing.T) {
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
Quobyte: &api.QuobyteVolumeSource{Registry: "reg:7861", Volume: "vol", ReadOnly: false, User: "root", Group: "root"}, Quobyte: &v1.QuobyteVolumeSource{Registry: "reg:7861", Volume: "vol", ReadOnly: false, User: "root", Group: "root"},
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -191,7 +191,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -191,7 +191,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
"path" "path"
"strings" "strings"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
"github.com/golang/glog" "github.com/golang/glog"
...@@ -32,8 +32,8 @@ type quobyteVolumeManager struct { ...@@ -32,8 +32,8 @@ type quobyteVolumeManager struct {
config *quobyteAPIConfig config *quobyteAPIConfig
} }
func (manager *quobyteVolumeManager) createVolume(provisioner *quobyteVolumeProvisioner) (quobyte *api.QuobyteVolumeSource, size int, err error) { func (manager *quobyteVolumeManager) createVolume(provisioner *quobyteVolumeProvisioner) (quobyte *v1.QuobyteVolumeSource, size int, err error) {
capacity := provisioner.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := provisioner.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
volumeSize := int(volume.RoundUpSize(capacity.Value(), 1024*1024*1024)) volumeSize := int(volume.RoundUpSize(capacity.Value(), 1024*1024*1024))
// Quobyte has the concept of Volumes which doen't have a specific size (they can grow unlimited) // Quobyte has the concept of Volumes which doen't have a specific size (they can grow unlimited)
// to simulate a size constraint we could set here a Quota // to simulate a size constraint we could set here a Quota
...@@ -46,11 +46,11 @@ func (manager *quobyteVolumeManager) createVolume(provisioner *quobyteVolumeProv ...@@ -46,11 +46,11 @@ func (manager *quobyteVolumeManager) createVolume(provisioner *quobyteVolumeProv
} }
if _, err := manager.createQuobyteClient().CreateVolume(volumeRequest); err != nil { if _, err := manager.createQuobyteClient().CreateVolume(volumeRequest); err != nil {
return &api.QuobyteVolumeSource{}, volumeSize, err return &v1.QuobyteVolumeSource{}, volumeSize, err
} }
glog.V(4).Infof("Created Quobyte volume %s", provisioner.volume) glog.V(4).Infof("Created Quobyte volume %s", provisioner.volume)
return &api.QuobyteVolumeSource{ return &v1.QuobyteVolumeSource{
Registry: provisioner.registry, Registry: provisioner.registry,
Volume: provisioner.volume, Volume: provisioner.volume,
User: provisioner.user, User: provisioner.user,
......
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
"os" "os"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
) )
...@@ -39,7 +39,7 @@ type diskManager interface { ...@@ -39,7 +39,7 @@ type diskManager interface {
// Detaches the disk from the kubelet's host machine. // Detaches the disk from the kubelet's host machine.
DetachDisk(disk rbdUnmounter, mntPath string) error DetachDisk(disk rbdUnmounter, mntPath string) error
// Creates a rbd image // Creates a rbd image
CreateImage(provisioner *rbdVolumeProvisioner) (r *api.RBDVolumeSource, volumeSizeGB int, err error) CreateImage(provisioner *rbdVolumeProvisioner) (r *v1.RBDVolumeSource, volumeSizeGB int, err error)
// Deletes a rbd image // Deletes a rbd image
DeleteImage(deleter *rbdVolumeDeleter) error DeleteImage(deleter *rbdVolumeDeleter) error
} }
......
...@@ -21,9 +21,9 @@ import ( ...@@ -21,9 +21,9 @@ import (
dstrings "strings" dstrings "strings"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" "k8s.io/kubernetes/pkg/api/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -86,14 +86,14 @@ func (plugin *rbdPlugin) RequiresRemount() bool { ...@@ -86,14 +86,14 @@ func (plugin *rbdPlugin) RequiresRemount() bool {
return false return false
} }
func (plugin *rbdPlugin) GetAccessModes() []api.PersistentVolumeAccessMode { func (plugin *rbdPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
return []api.PersistentVolumeAccessMode{ return []v1.PersistentVolumeAccessMode{
api.ReadWriteOnce, v1.ReadWriteOnce,
api.ReadOnlyMany, v1.ReadOnlyMany,
} }
} }
func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.VolumeOptions) (volume.Mounter, error) { func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.VolumeOptions) (volume.Mounter, error) {
var secret string var secret string
var err error var err error
source, _ := plugin.getRBDVolumeSource(spec) source, _ := plugin.getRBDVolumeSource(spec)
...@@ -109,7 +109,7 @@ func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.Vo ...@@ -109,7 +109,7 @@ func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, _ volume.Vo
return plugin.newMounterInternal(spec, pod.UID, &RBDUtil{}, plugin.host.GetMounter(), secret) return plugin.newMounterInternal(spec, pod.UID, &RBDUtil{}, plugin.host.GetMounter(), secret)
} }
func (plugin *rbdPlugin) getRBDVolumeSource(spec *volume.Spec) (*api.RBDVolumeSource, bool) { func (plugin *rbdPlugin) getRBDVolumeSource(spec *volume.Spec) (*v1.RBDVolumeSource, bool) {
// rbd volumes used directly in a pod have a ReadOnly flag set by the pod author. // rbd volumes used directly in a pod have a ReadOnly flag set by the pod author.
// rbd volumes used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV // rbd volumes used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV
if spec.Volume != nil && spec.Volume.RBD != nil { if spec.Volume != nil && spec.Volume.RBD != nil {
...@@ -165,10 +165,10 @@ func (plugin *rbdPlugin) newUnmounterInternal(volName string, podUID types.UID, ...@@ -165,10 +165,10 @@ func (plugin *rbdPlugin) newUnmounterInternal(volName string, podUID types.UID,
} }
func (plugin *rbdPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *rbdPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
rbdVolume := &api.Volume{ rbdVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
RBD: &api.RBDVolumeSource{ RBD: &v1.RBDVolumeSource{
CephMonitors: []string{}, CephMonitors: []string{},
}, },
}, },
...@@ -244,7 +244,7 @@ type rbdVolumeProvisioner struct { ...@@ -244,7 +244,7 @@ type rbdVolumeProvisioner struct {
options volume.VolumeOptions options volume.VolumeOptions
} }
func (r *rbdVolumeProvisioner) Provision() (*api.PersistentVolume, error) { func (r *rbdVolumeProvisioner) Provision() (*v1.PersistentVolume, error) {
if r.options.PVC.Spec.Selector != nil { if r.options.PVC.Spec.Selector != nil {
return nil, fmt.Errorf("claim Selector is not supported") return nil, fmt.Errorf("claim Selector is not supported")
} }
...@@ -311,8 +311,8 @@ func (r *rbdVolumeProvisioner) Provision() (*api.PersistentVolume, error) { ...@@ -311,8 +311,8 @@ func (r *rbdVolumeProvisioner) Provision() (*api.PersistentVolume, error) {
return nil, fmt.Errorf("rbd: create volume failed, err: %v", err) return nil, fmt.Errorf("rbd: create volume failed, err: %v", err)
} }
glog.Infof("successfully created rbd image %q", image) glog.Infof("successfully created rbd image %q", image)
pv := new(api.PersistentVolume) pv := new(v1.PersistentVolume)
rbd.SecretRef = new(api.LocalObjectReference) rbd.SecretRef = new(v1.LocalObjectReference)
rbd.SecretRef.Name = secretName rbd.SecretRef.Name = secretName
rbd.RadosUser = r.Id rbd.RadosUser = r.Id
pv.Spec.PersistentVolumeSource.RBD = rbd pv.Spec.PersistentVolumeSource.RBD = rbd
...@@ -321,8 +321,8 @@ func (r *rbdVolumeProvisioner) Provision() (*api.PersistentVolume, error) { ...@@ -321,8 +321,8 @@ func (r *rbdVolumeProvisioner) Provision() (*api.PersistentVolume, error) {
if len(pv.Spec.AccessModes) == 0 { if len(pv.Spec.AccessModes) == 0 {
pv.Spec.AccessModes = r.plugin.GetAccessModes() pv.Spec.AccessModes = r.plugin.GetAccessModes()
} }
pv.Spec.Capacity = api.ResourceList{ pv.Spec.Capacity = v1.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dMi", sizeMB)), v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dMi", sizeMB)),
} }
return pv, nil return pv, nil
} }
...@@ -424,7 +424,7 @@ func (plugin *rbdPlugin) execCommand(command string, args []string) ([]byte, err ...@@ -424,7 +424,7 @@ func (plugin *rbdPlugin) execCommand(command string, args []string) ([]byte, err
} }
func getVolumeSource( func getVolumeSource(
spec *volume.Spec) (*api.RBDVolumeSource, bool, error) { spec *volume.Spec) (*v1.RBDVolumeSource, bool, error) {
if spec.Volume != nil && spec.Volume.RBD != nil { if spec.Volume != nil && spec.Volume.RBD != nil {
return spec.Volume.RBD, spec.Volume.RBD.ReadOnly, nil return spec.Volume.RBD, spec.Volume.RBD.ReadOnly, nil
} else if spec.PersistentVolume != nil && } else if spec.PersistentVolume != nil &&
...@@ -435,7 +435,7 @@ func getVolumeSource( ...@@ -435,7 +435,7 @@ func getVolumeSource(
return nil, false, fmt.Errorf("Spec does not reference a RBD volume type") return nil, false, fmt.Errorf("Spec does not reference a RBD volume type")
} }
func parsePodSecret(pod *api.Pod, secretName string, kubeClient clientset.Interface) (string, error) { func parsePodSecret(pod *v1.Pod, secretName string, kubeClient clientset.Interface) (string, error) {
secret, err := volutil.GetSecretForPod(pod, secretName, kubeClient) secret, err := volutil.GetSecretForPod(pod, secretName, kubeClient)
if err != nil { if err != nil {
glog.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName) glog.Errorf("failed to get secret from [%q/%q]", pod.Namespace, secretName)
......
...@@ -21,8 +21,8 @@ import ( ...@@ -21,8 +21,8 @@ import (
"os" "os"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
utiltesting "k8s.io/kubernetes/pkg/util/testing" utiltesting "k8s.io/kubernetes/pkg/util/testing"
...@@ -47,7 +47,7 @@ func TestCanSupport(t *testing.T) { ...@@ -47,7 +47,7 @@ func TestCanSupport(t *testing.T) {
if plug.GetPluginName() != "kubernetes.io/rbd" { if plug.GetPluginName() != "kubernetes.io/rbd" {
t.Errorf("Wrong name: %s", plug.GetPluginName()) t.Errorf("Wrong name: %s", plug.GetPluginName())
} }
if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { if plug.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{}}}) {
t.Errorf("Expected false") t.Errorf("Expected false")
} }
} }
...@@ -87,7 +87,7 @@ func (fake *fakeDiskManager) DetachDisk(c rbdUnmounter, mntPath string) error { ...@@ -87,7 +87,7 @@ func (fake *fakeDiskManager) DetachDisk(c rbdUnmounter, mntPath string) error {
return nil return nil
} }
func (fake *fakeDiskManager) CreateImage(provisioner *rbdVolumeProvisioner) (r *api.RBDVolumeSource, volumeSizeGB int, err error) { func (fake *fakeDiskManager) CreateImage(provisioner *rbdVolumeProvisioner) (r *v1.RBDVolumeSource, volumeSizeGB int, err error) {
return nil, 0, fmt.Errorf("not implemented") return nil, 0, fmt.Errorf("not implemented")
} }
...@@ -155,10 +155,10 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { ...@@ -155,10 +155,10 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
} }
func TestPluginVolume(t *testing.T) { func TestPluginVolume(t *testing.T) {
vol := &api.Volume{ vol := &v1.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
RBD: &api.RBDVolumeSource{ RBD: &v1.RBDVolumeSource{
CephMonitors: []string{"a", "b"}, CephMonitors: []string{"a", "b"},
RBDImage: "bar", RBDImage: "bar",
FSType: "ext4", FSType: "ext4",
...@@ -168,13 +168,13 @@ func TestPluginVolume(t *testing.T) { ...@@ -168,13 +168,13 @@ func TestPluginVolume(t *testing.T) {
doTestPlugin(t, volume.NewSpecFromVolume(vol)) doTestPlugin(t, volume.NewSpecFromVolume(vol))
} }
func TestPluginPersistentVolume(t *testing.T) { func TestPluginPersistentVolume(t *testing.T) {
vol := &api.PersistentVolume{ vol := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "vol1", Name: "vol1",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
RBD: &api.RBDVolumeSource{ RBD: &v1.RBDVolumeSource{
CephMonitors: []string{"a", "b"}, CephMonitors: []string{"a", "b"},
RBDImage: "bar", RBDImage: "bar",
FSType: "ext4", FSType: "ext4",
...@@ -193,34 +193,34 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -193,34 +193,34 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
} }
defer os.RemoveAll(tmpDir) defer os.RemoveAll(tmpDir)
pv := &api.PersistentVolume{ pv := &v1.PersistentVolume{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "pvA", Name: "pvA",
}, },
Spec: api.PersistentVolumeSpec{ Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: v1.PersistentVolumeSource{
RBD: &api.RBDVolumeSource{ RBD: &v1.RBDVolumeSource{
CephMonitors: []string{"a", "b"}, CephMonitors: []string{"a", "b"},
RBDImage: "bar", RBDImage: "bar",
FSType: "ext4", FSType: "ext4",
}, },
}, },
ClaimRef: &api.ObjectReference{ ClaimRef: &v1.ObjectReference{
Name: "claimA", Name: "claimA",
}, },
}, },
} }
claim := &api.PersistentVolumeClaim{ claim := &v1.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: "claimA", Name: "claimA",
Namespace: "nsA", Namespace: "nsA",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "pvA", VolumeName: "pvA",
}, },
Status: api.PersistentVolumeClaimStatus{ Status: v1.PersistentVolumeClaimStatus{
Phase: api.ClaimBound, Phase: v1.ClaimBound,
}, },
} }
...@@ -232,7 +232,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) { ...@@ -232,7 +232,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes // readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
spec := volume.NewSpecFromPersistentVolume(pv, true) spec := volume.NewSpecFromPersistentVolume(pv, true)
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{UID: types.UID("poduid")}}
mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{}) mounter, _ := plug.NewMounter(spec, pod, volume.VolumeOptions{})
if !mounter.GetAttributes().ReadOnly { if !mounter.GetAttributes().ReadOnly {
......
...@@ -34,7 +34,7 @@ import ( ...@@ -34,7 +34,7 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/node" "k8s.io/kubernetes/pkg/util/node"
...@@ -313,8 +313,8 @@ func (util *RBDUtil) DetachDisk(c rbdUnmounter, mntPath string) error { ...@@ -313,8 +313,8 @@ func (util *RBDUtil) DetachDisk(c rbdUnmounter, mntPath string) error {
return nil return nil
} }
func (util *RBDUtil) CreateImage(p *rbdVolumeProvisioner) (r *api.RBDVolumeSource, size int, err error) { func (util *RBDUtil) CreateImage(p *rbdVolumeProvisioner) (r *v1.RBDVolumeSource, size int, err error) {
capacity := p.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)] capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
volSizeBytes := capacity.Value() volSizeBytes := capacity.Value()
// convert to MB that rbd defaults on // convert to MB that rbd defaults on
sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024)) sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024))
...@@ -342,7 +342,7 @@ func (util *RBDUtil) CreateImage(p *rbdVolumeProvisioner) (r *api.RBDVolumeSourc ...@@ -342,7 +342,7 @@ func (util *RBDUtil) CreateImage(p *rbdVolumeProvisioner) (r *api.RBDVolumeSourc
return nil, 0, err return nil, 0, err
} }
return &api.RBDVolumeSource{ return &v1.RBDVolumeSource{
CephMonitors: p.rbdMounter.Mon, CephMonitors: p.rbdMounter.Mon,
RBDImage: p.rbdMounter.Image, RBDImage: p.rbdMounter.Image,
RBDPool: p.rbdMounter.Pool, RBDPool: p.rbdMounter.Pool,
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ import (
"runtime" "runtime"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
ioutil "k8s.io/kubernetes/pkg/util/io" ioutil "k8s.io/kubernetes/pkg/util/io"
"k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/mount"
...@@ -49,7 +49,7 @@ var _ volume.VolumePlugin = &secretPlugin{} ...@@ -49,7 +49,7 @@ var _ volume.VolumePlugin = &secretPlugin{}
func wrappedVolumeSpec() volume.Spec { func wrappedVolumeSpec() volume.Spec {
return volume.Spec{ return volume.Spec{
Volume: &api.Volume{VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}}}, Volume: &v1.Volume{VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{Medium: v1.StorageMediumMemory}}},
} }
} }
...@@ -83,7 +83,7 @@ func (plugin *secretPlugin) RequiresRemount() bool { ...@@ -83,7 +83,7 @@ func (plugin *secretPlugin) RequiresRemount() bool {
return true return true
} }
func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volume.VolumeOptions) (volume.Mounter, error) {
return &secretVolumeMounter{ return &secretVolumeMounter{
secretVolume: &secretVolume{ secretVolume: &secretVolume{
spec.Name(), spec.Name(),
...@@ -113,10 +113,10 @@ func (plugin *secretPlugin) NewUnmounter(volName string, podUID types.UID) (volu ...@@ -113,10 +113,10 @@ func (plugin *secretPlugin) NewUnmounter(volName string, podUID types.UID) (volu
} }
func (plugin *secretPlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) { func (plugin *secretPlugin) ConstructVolumeSpec(volName, mountPath string) (*volume.Spec, error) {
secretVolume := &api.Volume{ secretVolume := &v1.Volume{
Name: volName, Name: volName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Secret: &api.SecretVolumeSource{ Secret: &v1.SecretVolumeSource{
SecretName: volName, SecretName: volName,
}, },
}, },
...@@ -144,8 +144,8 @@ func (sv *secretVolume) GetPath() string { ...@@ -144,8 +144,8 @@ func (sv *secretVolume) GetPath() string {
type secretVolumeMounter struct { type secretVolumeMounter struct {
*secretVolume *secretVolume
source api.SecretVolumeSource source v1.SecretVolumeSource
pod api.Pod pod v1.Pod
opts *volume.VolumeOptions opts *volume.VolumeOptions
} }
...@@ -232,7 +232,7 @@ func (b *secretVolumeMounter) SetUpAt(dir string, fsGroup *int64) error { ...@@ -232,7 +232,7 @@ func (b *secretVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
return nil return nil
} }
func makePayload(mappings []api.KeyToPath, secret *api.Secret, defaultMode *int32) (map[string]volumeutil.FileProjection, error) { func makePayload(mappings []v1.KeyToPath, secret *v1.Secret, defaultMode *int32) (map[string]volumeutil.FileProjection, error) {
if defaultMode == nil { if defaultMode == nil {
return nil, fmt.Errorf("No defaultMode used, not even the default value for it") return nil, fmt.Errorf("No defaultMode used, not even the default value for it")
} }
...@@ -267,7 +267,7 @@ func makePayload(mappings []api.KeyToPath, secret *api.Secret, defaultMode *int3 ...@@ -267,7 +267,7 @@ func makePayload(mappings []api.KeyToPath, secret *api.Secret, defaultMode *int3
return payload, nil return payload, nil
} }
func totalSecretBytes(secret *api.Secret) int { func totalSecretBytes(secret *v1.Secret) int {
totalSize := 0 totalSize := 0
for _, bytes := range secret.Data { for _, bytes := range secret.Data {
totalSize += len(bytes) totalSize += len(bytes)
...@@ -303,9 +303,9 @@ func (c *secretVolumeUnmounter) TearDownAt(dir string) error { ...@@ -303,9 +303,9 @@ func (c *secretVolumeUnmounter) TearDownAt(dir string) error {
return wrapped.TearDownAt(dir) return wrapped.TearDownAt(dir)
} }
func getVolumeSource(spec *volume.Spec) (*api.SecretVolumeSource, bool) { func getVolumeSource(spec *volume.Spec) (*v1.SecretVolumeSource, bool) {
var readOnly bool var readOnly bool
var volumeSource *api.SecretVolumeSource var volumeSource *v1.SecretVolumeSource
if spec.Volume != nil && spec.Volume.Secret != nil { if spec.Volume != nil && spec.Volume.Secret != nil {
volumeSource = spec.Volume.Secret volumeSource = spec.Volume.Secret
......
...@@ -26,9 +26,9 @@ import ( ...@@ -26,9 +26,9 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" clientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir" "k8s.io/kubernetes/pkg/volume/empty_dir"
...@@ -42,15 +42,15 @@ func TestMakePayload(t *testing.T) { ...@@ -42,15 +42,15 @@ func TestMakePayload(t *testing.T) {
caseMappingMode := int32(0400) caseMappingMode := int32(0400)
cases := []struct { cases := []struct {
name string name string
mappings []api.KeyToPath mappings []v1.KeyToPath
secret *api.Secret secret *v1.Secret
mode int32 mode int32
payload map[string]util.FileProjection payload map[string]util.FileProjection
success bool success bool
}{ }{
{ {
name: "no overrides", name: "no overrides",
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -65,13 +65,13 @@ func TestMakePayload(t *testing.T) { ...@@ -65,13 +65,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "basic 1", name: "basic 1",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/foo.txt", Path: "path/to/foo.txt",
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -85,13 +85,13 @@ func TestMakePayload(t *testing.T) { ...@@ -85,13 +85,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "subdirs", name: "subdirs",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/1/2/3/foo.txt", Path: "path/to/1/2/3/foo.txt",
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -105,13 +105,13 @@ func TestMakePayload(t *testing.T) { ...@@ -105,13 +105,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "subdirs 2", name: "subdirs 2",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/1/2/3/foo.txt", Path: "path/to/1/2/3/foo.txt",
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -125,7 +125,7 @@ func TestMakePayload(t *testing.T) { ...@@ -125,7 +125,7 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "subdirs 3", name: "subdirs 3",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "path/to/1/2/3/foo.txt", Path: "path/to/1/2/3/foo.txt",
...@@ -135,7 +135,7 @@ func TestMakePayload(t *testing.T) { ...@@ -135,7 +135,7 @@ func TestMakePayload(t *testing.T) {
Path: "another/path/to/the/esteemed/bar.bin", Path: "another/path/to/the/esteemed/bar.bin",
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -150,13 +150,13 @@ func TestMakePayload(t *testing.T) { ...@@ -150,13 +150,13 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "non existent key", name: "non existent key",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "zab", Key: "zab",
Path: "path/to/foo.txt", Path: "path/to/foo.txt",
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -167,7 +167,7 @@ func TestMakePayload(t *testing.T) { ...@@ -167,7 +167,7 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "mapping with Mode", name: "mapping with Mode",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "foo.txt", Path: "foo.txt",
...@@ -179,7 +179,7 @@ func TestMakePayload(t *testing.T) { ...@@ -179,7 +179,7 @@ func TestMakePayload(t *testing.T) {
Mode: &caseMappingMode, Mode: &caseMappingMode,
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -194,7 +194,7 @@ func TestMakePayload(t *testing.T) { ...@@ -194,7 +194,7 @@ func TestMakePayload(t *testing.T) {
}, },
{ {
name: "mapping with defaultMode", name: "mapping with defaultMode",
mappings: []api.KeyToPath{ mappings: []v1.KeyToPath{
{ {
Key: "foo", Key: "foo",
Path: "foo.txt", Path: "foo.txt",
...@@ -204,7 +204,7 @@ func TestMakePayload(t *testing.T) { ...@@ -204,7 +204,7 @@ func TestMakePayload(t *testing.T) {
Path: "bar.bin", Path: "bar.bin",
}, },
}, },
secret: &api.Secret{ secret: &v1.Secret{
Data: map[string][]byte{ Data: map[string][]byte{
"foo": []byte("foo"), "foo": []byte("foo"),
"bar": []byte("bar"), "bar": []byte("bar"),
...@@ -263,7 +263,7 @@ func TestCanSupport(t *testing.T) { ...@@ -263,7 +263,7 @@ func TestCanSupport(t *testing.T) {
if plugin.GetPluginName() != secretPluginName { if plugin.GetPluginName() != secretPluginName {
t.Errorf("Wrong name: %s", plugin.GetPluginName()) t.Errorf("Wrong name: %s", plugin.GetPluginName())
} }
if !plugin.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{Secret: &api.SecretVolumeSource{SecretName: ""}}}}) { if !plugin.CanSupport(&volume.Spec{Volume: &v1.Volume{VolumeSource: v1.VolumeSource{Secret: &v1.SecretVolumeSource{SecretName: ""}}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
if plugin.CanSupport(&volume.Spec{}) { if plugin.CanSupport(&volume.Spec{}) {
...@@ -292,7 +292,7 @@ func TestPlugin(t *testing.T) { ...@@ -292,7 +292,7 @@ func TestPlugin(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -365,7 +365,7 @@ func TestPluginReboot(t *testing.T) { ...@@ -365,7 +365,7 @@ func TestPluginReboot(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
pod := &api.Pod{ObjectMeta: api.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} pod := &v1.Pod{ObjectMeta: v1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}}
mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{}) mounter, err := plugin.NewMounter(volume.NewSpecFromVolume(volumeSpec), pod, volume.VolumeOptions{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err) t.Errorf("Failed to make a new Mounter: %v", err)
...@@ -397,11 +397,11 @@ func TestPluginReboot(t *testing.T) { ...@@ -397,11 +397,11 @@ func TestPluginReboot(t *testing.T) {
doTestCleanAndTeardown(plugin, testPodUID, testVolumeName, volumePath, t) doTestCleanAndTeardown(plugin, testPodUID, testVolumeName, volumePath, t)
} }
func volumeSpec(volumeName, secretName string, defaultMode int32) *api.Volume { func volumeSpec(volumeName, secretName string, defaultMode int32) *v1.Volume {
return &api.Volume{ return &v1.Volume{
Name: volumeName, Name: volumeName,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
Secret: &api.SecretVolumeSource{ Secret: &v1.SecretVolumeSource{
SecretName: secretName, SecretName: secretName,
DefaultMode: &defaultMode, DefaultMode: &defaultMode,
}, },
...@@ -409,9 +409,9 @@ func volumeSpec(volumeName, secretName string, defaultMode int32) *api.Volume { ...@@ -409,9 +409,9 @@ func volumeSpec(volumeName, secretName string, defaultMode int32) *api.Volume {
} }
} }
func secret(namespace, name string) api.Secret { func secret(namespace, name string) v1.Secret {
return api.Secret{ return v1.Secret{
ObjectMeta: api.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Namespace: namespace, Namespace: namespace,
Name: name, Name: name,
}, },
...@@ -423,7 +423,7 @@ func secret(namespace, name string) api.Secret { ...@@ -423,7 +423,7 @@ func secret(namespace, name string) api.Secret {
} }
} }
func doTestSecretDataInVolume(volumePath string, secret api.Secret, t *testing.T) { func doTestSecretDataInVolume(volumePath string, secret v1.Secret, t *testing.T) {
for key, value := range secret.Data { for key, value := range secret.Data {
secretDataHostPath := path.Join(volumePath, key) secretDataHostPath := path.Join(volumePath, key)
if _, err := os.Stat(secretDataHostPath); err != nil { if _, err := os.Stat(secretDataHostPath); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment