Rename AWSPersistentDisk -> AWSElasticBlockStore, aws-pd -> aws-ebs

Per comments from @markturansky - thanks!
This commit is contained in:
Justin Santa Barbara 2015-04-07 14:16:36 -07:00
parent b3666ed08c
commit 9711e771c5
15 changed files with 92 additions and 92 deletions

View File

@ -173,7 +173,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
func(vs *api.VolumeSource, c fuzz.Continue) { func(vs *api.VolumeSource, c fuzz.Continue) {
// Exactly one of the fields should be set. // Exactly one of the fields should be set.
//FIXME: the fuzz can still end up nil. What if fuzz allowed me to say that? //FIXME: the fuzz can still end up nil. What if fuzz allowed me to say that?
fuzzOneOf(c, &vs.HostPath, &vs.EmptyDir, &vs.GCEPersistentDisk, &vs.AWSPersistentDisk, &vs.GitRepo, &vs.Secret, &vs.NFS, &vs.ISCSI, &vs.Glusterfs) fuzzOneOf(c, &vs.HostPath, &vs.EmptyDir, &vs.GCEPersistentDisk, &vs.AWSElasticBlockStore, &vs.GitRepo, &vs.Secret, &vs.NFS, &vs.ISCSI, &vs.Glusterfs)
}, },
func(d *api.DNSPolicy, c fuzz.Continue) { func(d *api.DNSPolicy, c fuzz.Continue) {
policies := []api.DNSPolicy{api.DNSClusterFirst, api.DNSDefault} policies := []api.DNSPolicy{api.DNSClusterFirst, api.DNSDefault}

View File

@ -189,9 +189,9 @@ type VolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk"`
// AWSPersistentDisk represents a AWS EBS disk that is attached to a // AWSElasticBlockStore represents a AWS EBS disk that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore"`
// GitRepo represents a git repository at a particular revision. // GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo"` GitRepo *GitRepoVolumeSource `json:"gitRepo"`
// Secret represents a secret that should populate this volume. // Secret represents a secret that should populate this volume.
@ -211,9 +211,9 @@ type PersistentVolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk"`
// AWSPersistentDisk represents a AWS EBS disk that is attached to a // AWSElasticBlockStore represents a AWS EBS disk that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore"`
// HostPath represents a directory on the host. // HostPath represents a directory on the host.
// This is useful for development and testing only. // This is useful for development and testing only.
// on-host storage is not supported in any way // on-host storage is not supported in any way
@ -400,12 +400,12 @@ type ISCSIVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty"` ReadOnly bool `json:"readOnly,omitempty"`
} }
// AWSPersistentDiskVolumeSource represents a Persistent Disk resource in AWS. // AWSElasticBlockStoreVolumeSource represents a Persistent Disk resource in AWS.
// //
// An AWS EBS disk must exist and be formatted before mounting to a container. // An AWS EBS disk must exist and be formatted before mounting to a container.
// The disk must also be in the same AWS zone as the kubelet. // The disk must also be in the same AWS zone as the kubelet.
// A AWS EBS disk can only be mounted as read/write once. // A AWS EBS disk can only be mounted as read/write once.
type AWSPersistentDiskVolumeSource struct { type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the persistent disk resource. Used to identify the disk in AWS // Unique id of the persistent disk resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId"` VolumeId string `json:"volumeId"`
// Required: Filesystem type to mount. // Required: Filesystem type to mount.

View File

@ -1170,7 +1170,7 @@ func init() {
if err := s.Convert(&in.ISCSI, &out.ISCSI, 0); err != nil { if err := s.Convert(&in.ISCSI, &out.ISCSI, 0); err != nil {
return err return err
} }
if err := s.Convert(&in.AWSPersistentDisk, &out.AWSPersistentDisk, 0); err != nil { if err := s.Convert(&in.AWSElasticBlockStore, &out.AWSElasticBlockStore, 0); err != nil {
return err return err
} }
if err := s.Convert(&in.HostPath, &out.HostDir, 0); err != nil { if err := s.Convert(&in.HostPath, &out.HostDir, 0); err != nil {
@ -1200,7 +1200,7 @@ func init() {
if err := s.Convert(&in.ISCSI, &out.ISCSI, 0); err != nil { if err := s.Convert(&in.ISCSI, &out.ISCSI, 0); err != nil {
return err return err
} }
if err := s.Convert(&in.AWSPersistentDisk, &out.AWSPersistentDisk, 0); err != nil { if err := s.Convert(&in.AWSElasticBlockStore, &out.AWSElasticBlockStore, 0); err != nil {
return err return err
} }
if err := s.Convert(&in.HostDir, &out.HostPath, 0); err != nil { if err := s.Convert(&in.HostDir, &out.HostPath, 0); err != nil {

View File

@ -88,7 +88,7 @@ type Volume struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
// This is optional for now. If not specified, the Volume is implied to be an EmptyDir. // This is optional for now. If not specified, the Volume is implied to be an EmptyDir.
// This implied behavior is deprecated and will be removed in a future version. // This implied behavior is deprecated and will be removed in a future version.
Source VolumeSource `json:"source,omitempty" description:"location and type of volume to mount; at most one of HostDir, EmptyDir, GCEPersistentDisk, AWSPersistentDisk, or GitRepo; default is EmptyDir"` Source VolumeSource `json:"source,omitempty" description:"location and type of volume to mount; at most one of HostDir, EmptyDir, GCEPersistentDisk, AWSElasticBlockStore, or GitRepo; default is EmptyDir"`
} }
// VolumeSource represents the source location of a volume to mount. // VolumeSource represents the source location of a volume to mount.
@ -105,9 +105,9 @@ type VolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource attached to the host machine on demand"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource attached to the host machine on demand"`
// AWSPersistentDisk represents a AWS Disk resource that is attached to a // AWSElasticBlockStore represents a AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk" description:"AWS disk resource attached to the host machine on demand"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource attached to the host machine on demand"`
// GitRepo represents a git repository at a particular revision. // GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"` GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"`
// Secret represents a secret to populate the volume with // Secret represents a secret to populate the volume with
@ -127,9 +127,9 @@ type PersistentVolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"`
// AWSPersistentDisk represents a AWS EBS volume that is attached to a // AWSElasticBlockStore represents a AWS EBS volume that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk" description:"AWS disk resource provisioned by an admin"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource provisioned by an admin"`
// HostPath represents a directory on the host. // HostPath represents a directory on the host.
// This is useful for development and testing only. // This is useful for development and testing only.
// on-host storage is not supported in any way. // on-host storage is not supported in any way.
@ -308,12 +308,12 @@ type ISCSIVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"read-only if true, read-write otherwise (false or unspecified)"` ReadOnly bool `json:"readOnly,omitempty" description:"read-only if true, read-write otherwise (false or unspecified)"`
} }
// AWSPersistentDiskVolumeSource represents a Persistent Disk resource in AWS. // AWSElasticBlockStoreVolumeSource represents a Persistent Disk resource in AWS.
// //
// An AWS PD must exist and be formatted before mounting to a container. // An AWS PD must exist and be formatted before mounting to a container.
// The disk must also be in the same AWS zone as the kubelet. // The disk must also be in the same AWS zone as the kubelet.
// A AWS PD can only be mounted on a single machine. // A AWS PD can only be mounted on a single machine.
type AWSPersistentDiskVolumeSource struct { type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the PD resource. Used to identify the disk in AWS // Unique id of the PD resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"` VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount. // Required: Filesystem type to mount.

View File

@ -1097,7 +1097,7 @@ func init() {
if err := s.Convert(&in.GCEPersistentDisk, &out.GCEPersistentDisk, 0); err != nil { if err := s.Convert(&in.GCEPersistentDisk, &out.GCEPersistentDisk, 0); err != nil {
return err return err
} }
if err := s.Convert(&in.AWSPersistentDisk, &out.AWSPersistentDisk, 0); err != nil { if err := s.Convert(&in.AWSElasticBlockStore, &out.AWSElasticBlockStore, 0); err != nil {
return err return err
} }
if err := s.Convert(&in.HostPath, &out.HostDir, 0); err != nil { if err := s.Convert(&in.HostPath, &out.HostDir, 0); err != nil {

View File

@ -55,7 +55,7 @@ type Volume struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
// This is optional for now. If not specified, the Volume is implied to be an EmptyDir. // This is optional for now. If not specified, the Volume is implied to be an EmptyDir.
// This implied behavior is deprecated and will be removed in a future version. // This implied behavior is deprecated and will be removed in a future version.
Source VolumeSource `json:"source,omitempty" description:"location and type of volume to mount; at most one of HostDir, EmptyDir, GCEPersistentDisk, AWSPersistentDisk, or GitRepo; default is EmptyDir"` Source VolumeSource `json:"source,omitempty" description:"location and type of volume to mount; at most one of HostDir, EmptyDir, GCEPersistentDisk, AWSElasticBlockStore, or GitRepo; default is EmptyDir"`
} }
// VolumeSource represents the source location of a volume to mount. // VolumeSource represents the source location of a volume to mount.
@ -76,7 +76,7 @@ type VolumeSource struct {
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource attached to the host machine on demand"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource attached to the host machine on demand"`
// An AWS persistent disk that is mounted to the // An AWS persistent disk that is mounted to the
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk" description:"AWS disk resource attached to the host machine on demand"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource attached to the host machine on demand"`
// GitRepo represents a git repository at a particular revision. // GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"` GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"`
// Secret is a secret to populate the volume with // Secret is a secret to populate the volume with
@ -96,9 +96,9 @@ type PersistentVolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"`
// AWSPersistentDisk represents a AWS Disk resource that is attached to a // AWSElasticBlockStore represents a AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk" description:"AWS disk resource provisioned by an admin"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource provisioned by an admin"`
// HostPath represents a directory on the host. // HostPath represents a directory on the host.
// This is useful for development and testing only. // This is useful for development and testing only.
// on-host storage is not supported in any way. // on-host storage is not supported in any way.
@ -290,12 +290,12 @@ type GCEPersistentDiskVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"read-only if true, read-write otherwise (false or unspecified)"` ReadOnly bool `json:"readOnly,omitempty" description:"read-only if true, read-write otherwise (false or unspecified)"`
} }
// AWSPersistentDiskVolumeSource represents a Persistent Disk resource in AWS. // AWSElasticBlockStoreVolumeSource represents a Persistent Disk resource in AWS.
// //
// An AWS PD must exist and be formatted before mounting to a container. // An AWS PD must exist and be formatted before mounting to a container.
// The disk must also be in the same AWS zone as the kubelet. // The disk must also be in the same AWS zone as the kubelet.
// A AWS PD can only be mounted on a single machine. // A AWS PD can only be mounted on a single machine.
type AWSPersistentDiskVolumeSource struct { type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the PD resource. Used to identify the disk in AWS // Unique id of the PD resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"` VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount. // Required: Filesystem type to mount.

View File

@ -206,9 +206,9 @@ type VolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk" description:"GCE disk resource attached to the host machine on demand"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk" description:"GCE disk resource attached to the host machine on demand"`
// AWSPersistentDisk represents a AWS Disk resource that is attached to a // AWSElasticBlockStore represents a AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk" description:"AWS disk resource attached to the host machine on demand"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource attached to the host machine on demand"`
// GitRepo represents a git repository at a particular revision. // GitRepo represents a git repository at a particular revision.
GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"` GitRepo *GitRepoVolumeSource `json:"gitRepo" description:"git repository at a particular revision"`
// Secret represents a secret that should populate this volume. // Secret represents a secret that should populate this volume.
@ -228,9 +228,9 @@ type PersistentVolumeSource struct {
// GCEPersistentDisk represents a GCE Disk resource that is attached to a // GCEPersistentDisk represents a GCE Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk" description:"GCE disk resource provisioned by an admin"` GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"gcePersistentDisk" description:"GCE disk resource provisioned by an admin"`
// AWSPersistentDisk represents a AWS Disk resource that is attached to a // AWSElasticBlockStore represents a AWS Disk resource that is attached to a
// kubelet's host machine and then exposed to the pod. // kubelet's host machine and then exposed to the pod.
AWSPersistentDisk *AWSPersistentDiskVolumeSource `json:"awsPersistentDisk" description:"AWS disk resource provisioned by an admin"` AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource `json:"awsElasticBlockStore" description:"AWS disk resource provisioned by an admin"`
// HostPath represents a directory on the host. // HostPath represents a directory on the host.
// This is useful for development and testing only. // This is useful for development and testing only.
// on-host storage is not supported in any way. // on-host storage is not supported in any way.
@ -406,12 +406,12 @@ type GCEPersistentDiskVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"read-only if true, read-write otherwise (false or unspecified)"` ReadOnly bool `json:"readOnly,omitempty" description:"read-only if true, read-write otherwise (false or unspecified)"`
} }
// AWSPersistentDiskVolumeSource represents a Persistent Disk resource in AWS. // AWSElasticBlockStoreVolumeSource represents a Persistent Disk resource in AWS.
// //
// An AWS PD must exist and be formatted before mounting to a container. // An AWS PD must exist and be formatted before mounting to a container.
// The disk must also be in the same AWS zone as the kubelet. // The disk must also be in the same AWS zone as the kubelet.
// A AWS PD can only be mounted on a single machine. // A AWS PD can only be mounted on a single machine.
type AWSPersistentDiskVolumeSource struct { type AWSElasticBlockStoreVolumeSource struct {
// Unique id of the PD resource. Used to identify the disk in AWS // Unique id of the PD resource. Used to identify the disk in AWS
VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"` VolumeId string `json:"volumeId" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount. // Required: Filesystem type to mount.

View File

@ -299,9 +299,9 @@ func validateSource(source *api.VolumeSource) errs.ValidationErrorList {
numVolumes++ numVolumes++
allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(source.GCEPersistentDisk).Prefix("persistentDisk")...) allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(source.GCEPersistentDisk).Prefix("persistentDisk")...)
} }
if source.AWSPersistentDisk != nil { if source.AWSElasticBlockStore != nil {
numVolumes++ numVolumes++
allErrs = append(allErrs, validateAWSPersistentDiskVolumeSource(source.AWSPersistentDisk).Prefix("awsPersistentDisk")...) allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(source.AWSElasticBlockStore).Prefix("awsElasticBlockStore")...)
} }
if source.Secret != nil { if source.Secret != nil {
numVolumes++ numVolumes++
@ -372,7 +372,7 @@ func validateGCEPersistentDiskVolumeSource(PD *api.GCEPersistentDiskVolumeSource
return allErrs return allErrs
} }
func validateAWSPersistentDiskVolumeSource(PD *api.AWSPersistentDiskVolumeSource) errs.ValidationErrorList { func validateAWSElasticBlockStoreVolumeSource(PD *api.AWSElasticBlockStoreVolumeSource) errs.ValidationErrorList {
allErrs := errs.ValidationErrorList{} allErrs := errs.ValidationErrorList{}
if PD.VolumeId == "" { if PD.VolumeId == "" {
allErrs = append(allErrs, errs.NewFieldRequired("volumeId")) allErrs = append(allErrs, errs.NewFieldRequired("volumeId"))
@ -444,9 +444,9 @@ func ValidatePersistentVolume(pv *api.PersistentVolume) errs.ValidationErrorList
numVolumes++ numVolumes++
allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(pv.Spec.GCEPersistentDisk).Prefix("persistentDisk")...) allErrs = append(allErrs, validateGCEPersistentDiskVolumeSource(pv.Spec.GCEPersistentDisk).Prefix("persistentDisk")...)
} }
if pv.Spec.AWSPersistentDisk != nil { if pv.Spec.AWSElasticBlockStore != nil {
numVolumes++ numVolumes++
allErrs = append(allErrs, validateAWSPersistentDiskVolumeSource(pv.Spec.AWSPersistentDisk).Prefix("awsPersistentDisk")...) allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(pv.Spec.AWSElasticBlockStore).Prefix("awsElasticBlockStore")...)
} }
if numVolumes != 1 { if numVolumes != 1 {
allErrs = append(allErrs, errs.NewFieldInvalid("", pv.Spec.PersistentVolumeSource, "exactly 1 volume type is required")) allErrs = append(allErrs, errs.NewFieldInvalid("", pv.Spec.PersistentVolumeSource, "exactly 1 volume type is required"))

View File

@ -516,7 +516,7 @@ func TestValidateVolumes(t *testing.T) {
{Name: "abc-123", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{"/mnt/path3"}}}, {Name: "abc-123", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{"/mnt/path3"}}},
{Name: "empty", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}}, {Name: "empty", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}},
{Name: "gcepd", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{"my-PD", "ext4", 1, false}}}, {Name: "gcepd", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{"my-PD", "ext4", 1, false}}},
{Name: "awspd", VolumeSource: api.VolumeSource{AWSPersistentDisk: &api.AWSPersistentDiskVolumeSource{"my-PD", "ext4", 1, false}}}, {Name: "awsebs", VolumeSource: api.VolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{"my-PD", "ext4", 1, false}}},
{Name: "gitrepo", VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{"my-repo", "hashstring"}}}, {Name: "gitrepo", VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{"my-repo", "hashstring"}}},
{Name: "iscsidisk", VolumeSource: api.VolumeSource{ISCSI: &api.ISCSIVolumeSource{"127.0.0.1", "iqn.2015-02.example.com:test", 1, "ext4", false}}}, {Name: "iscsidisk", VolumeSource: api.VolumeSource{ISCSI: &api.ISCSIVolumeSource{"127.0.0.1", "iqn.2015-02.example.com:test", 1, "ext4", false}}},
{Name: "secret", VolumeSource: api.VolumeSource{Secret: &api.SecretVolumeSource{"my-secret"}}}, {Name: "secret", VolumeSource: api.VolumeSource{Secret: &api.SecretVolumeSource{"my-secret"}}},

View File

@ -61,13 +61,13 @@ func isVolumeConflict(volume api.Volume, pod *api.Pod) bool {
} }
} }
} }
if volume.AWSPersistentDisk != nil { if volume.AWSElasticBlockStore != nil {
volumeId := volume.AWSPersistentDisk.VolumeId volumeId := volume.AWSElasticBlockStore.VolumeId
manifest := &(pod.Spec) manifest := &(pod.Spec)
for ix := range manifest.Volumes { for ix := range manifest.Volumes {
if manifest.Volumes[ix].AWSPersistentDisk != nil && if manifest.Volumes[ix].AWSElasticBlockStore != nil &&
manifest.Volumes[ix].AWSPersistentDisk.VolumeId == volumeId { manifest.Volumes[ix].AWSElasticBlockStore.VolumeId == volumeId {
return true return true
} }
} }

View File

@ -326,7 +326,7 @@ func TestAWSDiskConflicts(t *testing.T) {
Volumes: []api.Volume{ Volumes: []api.Volume{
{ {
VolumeSource: api.VolumeSource{ VolumeSource: api.VolumeSource{
AWSPersistentDisk: &api.AWSPersistentDiskVolumeSource{ AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: "foo", VolumeId: "foo",
}, },
}, },
@ -337,7 +337,7 @@ func TestAWSDiskConflicts(t *testing.T) {
Volumes: []api.Volume{ Volumes: []api.Volume{
{ {
VolumeSource: api.VolumeSource{ VolumeSource: api.VolumeSource{
AWSPersistentDisk: &api.AWSPersistentDiskVolumeSource{ AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: "bar", VolumeId: "bar",
}, },
}, },

View File

@ -37,55 +37,55 @@ import (
// This is the primary entrypoint for volume plugins. // This is the primary entrypoint for volume plugins.
func ProbeVolumePlugins() []volume.VolumePlugin { func ProbeVolumePlugins() []volume.VolumePlugin {
return []volume.VolumePlugin{&awsPersistentDiskPlugin{nil}} return []volume.VolumePlugin{&awsElasticBlockStorePlugin{nil}}
} }
type awsPersistentDiskPlugin struct { type awsElasticBlockStorePlugin struct {
host volume.VolumeHost host volume.VolumeHost
} }
var _ volume.VolumePlugin = &awsPersistentDiskPlugin{} var _ volume.VolumePlugin = &awsElasticBlockStorePlugin{}
const ( const (
awsPersistentDiskPluginName = "kubernetes.io/aws-pd" awsElasticBlockStorePluginName = "kubernetes.io/aws-ebs"
) )
func (plugin *awsPersistentDiskPlugin) Init(host volume.VolumeHost) { func (plugin *awsElasticBlockStorePlugin) Init(host volume.VolumeHost) {
plugin.host = host plugin.host = host
} }
func (plugin *awsPersistentDiskPlugin) Name() string { func (plugin *awsElasticBlockStorePlugin) Name() string {
return awsPersistentDiskPluginName return awsElasticBlockStorePluginName
} }
func (plugin *awsPersistentDiskPlugin) CanSupport(spec *api.Volume) bool { func (plugin *awsElasticBlockStorePlugin) CanSupport(spec *api.Volume) bool {
if spec.AWSPersistentDisk != nil { if spec.AWSElasticBlockStore != nil {
return true return true
} }
return false return false
} }
func (plugin *awsPersistentDiskPlugin) GetAccessModes() []api.AccessModeType { func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []api.AccessModeType {
return []api.AccessModeType{ return []api.AccessModeType{
api.ReadWriteOnce, api.ReadWriteOnce,
} }
} }
func (plugin *awsPersistentDiskPlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference) (volume.Builder, error) { func (plugin *awsElasticBlockStorePlugin) NewBuilder(spec *api.Volume, podRef *api.ObjectReference) (volume.Builder, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newBuilderInternal(spec, podRef.UID, &AWSDiskUtil{}, mount.New()) return plugin.newBuilderInternal(spec, podRef.UID, &AWSDiskUtil{}, mount.New())
} }
func (plugin *awsPersistentDiskPlugin) newBuilderInternal(spec *api.Volume, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Builder, error) { func (plugin *awsElasticBlockStorePlugin) newBuilderInternal(spec *api.Volume, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Builder, error) {
volumeId := spec.AWSPersistentDisk.VolumeId volumeId := spec.AWSElasticBlockStore.VolumeId
fsType := spec.AWSPersistentDisk.FSType fsType := spec.AWSElasticBlockStore.FSType
partition := "" partition := ""
if spec.AWSPersistentDisk.Partition != 0 { if spec.AWSElasticBlockStore.Partition != 0 {
partition = strconv.Itoa(spec.AWSPersistentDisk.Partition) partition = strconv.Itoa(spec.AWSElasticBlockStore.Partition)
} }
readOnly := spec.AWSPersistentDisk.ReadOnly readOnly := spec.AWSElasticBlockStore.ReadOnly
return &awsPersistentDisk{ return &awsElasticBlockStore{
podUID: podUID, podUID: podUID,
volName: spec.Name, volName: spec.Name,
volumeId: volumeId, volumeId: volumeId,
@ -99,13 +99,13 @@ func (plugin *awsPersistentDiskPlugin) newBuilderInternal(spec *api.Volume, podU
}, nil }, nil
} }
func (plugin *awsPersistentDiskPlugin) NewCleaner(volName string, podUID types.UID) (volume.Cleaner, error) { func (plugin *awsElasticBlockStorePlugin) NewCleaner(volName string, podUID types.UID) (volume.Cleaner, error) {
// Inject real implementations here, test through the internal function. // Inject real implementations here, test through the internal function.
return plugin.newCleanerInternal(volName, podUID, &AWSDiskUtil{}, mount.New()) return plugin.newCleanerInternal(volName, podUID, &AWSDiskUtil{}, mount.New())
} }
func (plugin *awsPersistentDiskPlugin) newCleanerInternal(volName string, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Cleaner, error) { func (plugin *awsElasticBlockStorePlugin) newCleanerInternal(volName string, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Cleaner, error) {
return &awsPersistentDisk{ return &awsElasticBlockStore{
podUID: podUID, podUID: podUID,
volName: volName, volName: volName,
manager: manager, manager: manager,
@ -118,14 +118,14 @@ func (plugin *awsPersistentDiskPlugin) newCleanerInternal(volName string, podUID
// Abstract interface to PD operations. // Abstract interface to PD operations.
type pdManager interface { type pdManager interface {
// Attaches the disk to the kubelet's host machine. // Attaches the disk to the kubelet's host machine.
AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath string) error AttachAndMountDisk(pd *awsElasticBlockStore, globalPDPath string) error
// Detaches the disk from the kubelet's host machine. // Detaches the disk from the kubelet's host machine.
DetachDisk(pd *awsPersistentDisk) error DetachDisk(pd *awsElasticBlockStore) error
} }
// awsPersistentDisk volumes are disk resources provided by Google Compute Engine // awsElasticBlockStore volumes are disk resources provided by Google Compute Engine
// that are attached to the kubelet's host machine and exposed to the pod. // that are attached to the kubelet's host machine and exposed to the pod.
type awsPersistentDisk struct { type awsElasticBlockStore struct {
volName string volName string
podUID types.UID podUID types.UID
// Unique id of the PD, used to find the disk resource in the provider. // Unique id of the PD, used to find the disk resource in the provider.
@ -142,10 +142,10 @@ type awsPersistentDisk struct {
mounter mount.Interface mounter mount.Interface
// diskMounter provides the interface that is used to mount the actual block device. // diskMounter provides the interface that is used to mount the actual block device.
diskMounter mount.Interface diskMounter mount.Interface
plugin *awsPersistentDiskPlugin plugin *awsElasticBlockStorePlugin
} }
func detachDiskLogError(pd *awsPersistentDisk) { func detachDiskLogError(pd *awsElasticBlockStore) {
err := pd.manager.DetachDisk(pd) err := pd.manager.DetachDisk(pd)
if err != nil { if err != nil {
glog.Warningf("Failed to detach disk: %v (%v)", pd, err) glog.Warningf("Failed to detach disk: %v (%v)", pd, err)
@ -153,7 +153,7 @@ func detachDiskLogError(pd *awsPersistentDisk) {
} }
// getVolumeProvider returns the AWS Volumes interface // getVolumeProvider returns the AWS Volumes interface
func (pd *awsPersistentDisk) getVolumeProvider() (aws_cloud.Volumes, error) { func (pd *awsElasticBlockStore) getVolumeProvider() (aws_cloud.Volumes, error) {
name := "aws" name := "aws"
cloud, err := cloudprovider.GetCloudProvider(name, nil) cloud, err := cloudprovider.GetCloudProvider(name, nil)
if err != nil { if err != nil {
@ -167,12 +167,12 @@ func (pd *awsPersistentDisk) getVolumeProvider() (aws_cloud.Volumes, error) {
} }
// SetUp attaches the disk and bind mounts to the volume path. // SetUp attaches the disk and bind mounts to the volume path.
func (pd *awsPersistentDisk) SetUp() error { func (pd *awsElasticBlockStore) SetUp() error {
return pd.SetUpAt(pd.GetPath()) return pd.SetUpAt(pd.GetPath())
} }
// SetUpAt attaches the disk and bind mounts to the volume path. // SetUpAt attaches the disk and bind mounts to the volume path.
func (pd *awsPersistentDisk) SetUpAt(dir string) error { func (pd *awsElasticBlockStore) SetUpAt(dir string) error {
// TODO: handle failed mounts here. // TODO: handle failed mounts here.
mountpoint, err := mount.IsMountPoint(dir) mountpoint, err := mount.IsMountPoint(dir)
glog.V(4).Infof("PersistentDisk set up: %s %v %v", dir, mountpoint, err) glog.V(4).Infof("PersistentDisk set up: %s %v %v", dir, mountpoint, err)
@ -236,11 +236,11 @@ func makeGlobalPDPath(host volume.VolumeHost, volumeId string) string {
// Clean up the URI to be more fs-friendly // Clean up the URI to be more fs-friendly
name := volumeId name := volumeId
name = strings.Replace(name, "://", "/", -1) name = strings.Replace(name, "://", "/", -1)
return path.Join(host.GetPluginDir(awsPersistentDiskPluginName), "mounts", name) return path.Join(host.GetPluginDir(awsElasticBlockStorePluginName), "mounts", name)
} }
func getVolumeIdFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) { func getVolumeIdFromGlobalMount(host volume.VolumeHost, globalPath string) (string, error) {
basePath := path.Join(host.GetPluginDir(awsPersistentDiskPluginName), "mounts") basePath := path.Join(host.GetPluginDir(awsElasticBlockStorePluginName), "mounts")
rel, err := filepath.Rel(basePath, globalPath) rel, err := filepath.Rel(basePath, globalPath)
if err != nil { if err != nil {
return "", err return "", err
@ -257,20 +257,20 @@ func getVolumeIdFromGlobalMount(host volume.VolumeHost, globalPath string) (stri
return volumeId, nil return volumeId, nil
} }
func (pd *awsPersistentDisk) GetPath() string { func (pd *awsElasticBlockStore) GetPath() string {
name := awsPersistentDiskPluginName name := awsElasticBlockStorePluginName
return pd.plugin.host.GetPodVolumeDir(pd.podUID, util.EscapeQualifiedNameForDisk(name), pd.volName) return pd.plugin.host.GetPodVolumeDir(pd.podUID, util.EscapeQualifiedNameForDisk(name), pd.volName)
} }
// Unmounts the bind mount, and detaches the disk only if the PD // Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet. // resource was the last reference to that disk on the kubelet.
func (pd *awsPersistentDisk) TearDown() error { func (pd *awsElasticBlockStore) TearDown() error {
return pd.TearDownAt(pd.GetPath()) return pd.TearDownAt(pd.GetPath())
} }
// Unmounts the bind mount, and detaches the disk only if the PD // Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet. // resource was the last reference to that disk on the kubelet.
func (pd *awsPersistentDisk) TearDownAt(dir string) error { func (pd *awsElasticBlockStore) TearDownAt(dir string) error {
mountpoint, err := mount.IsMountPoint(dir) mountpoint, err := mount.IsMountPoint(dir)
if err != nil { if err != nil {
glog.V(2).Info("Error checking if mountpoint ", dir, ": ", err) glog.V(2).Info("Error checking if mountpoint ", dir, ": ", err)

View File

@ -30,14 +30,14 @@ func TestCanSupport(t *testing.T) {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil))
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-pd") plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
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 plug.Name() != "kubernetes.io/aws-pd" { if plug.Name() != "kubernetes.io/aws-ebs" {
t.Errorf("Wrong name: %s", plug.Name()) t.Errorf("Wrong name: %s", plug.Name())
} }
if !plug.CanSupport(&api.Volume{VolumeSource: api.VolumeSource{AWSPersistentDisk: &api.AWSPersistentDiskVolumeSource{}}}) { if !plug.CanSupport(&api.Volume{VolumeSource: api.VolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}}) {
t.Errorf("Expected true") t.Errorf("Expected true")
} }
} }
@ -46,7 +46,7 @@ func TestGetAccessModes(t *testing.T) {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil))
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/aws-pd") plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/aws-ebs")
if err != nil { if err != nil {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
@ -71,7 +71,7 @@ type fakePDManager struct{}
// TODO(jonesdl) To fully test this, we could create a loopback device // TODO(jonesdl) To fully test this, we could create a loopback device
// and mount that instead. // and mount that instead.
func (fake *fakePDManager) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath string) error { func (fake *fakePDManager) AttachAndMountDisk(pd *awsElasticBlockStore, globalPDPath string) error {
globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId) globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
err := os.MkdirAll(globalPath, 0750) err := os.MkdirAll(globalPath, 0750)
if err != nil { if err != nil {
@ -80,7 +80,7 @@ func (fake *fakePDManager) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPat
return nil return nil
} }
func (fake *fakePDManager) DetachDisk(pd *awsPersistentDisk) error { func (fake *fakePDManager) DetachDisk(pd *awsElasticBlockStore) error {
globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId) globalPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
err := os.RemoveAll(globalPath) err := os.RemoveAll(globalPath)
if err != nil { if err != nil {
@ -93,20 +93,20 @@ func TestPlugin(t *testing.T) {
plugMgr := volume.VolumePluginMgr{} plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil)) plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil))
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-pd") plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
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 := &api.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{ VolumeSource: api.VolumeSource{
AWSPersistentDisk: &api.AWSPersistentDiskVolumeSource{ AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: "pd", VolumeId: "pd",
FSType: "ext4", FSType: "ext4",
}, },
}, },
} }
builder, err := plug.(*awsPersistentDiskPlugin).newBuilderInternal(spec, types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) builder, err := plug.(*awsElasticBlockStorePlugin).newBuilderInternal(spec, types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Builder: %v", err) t.Errorf("Failed to make a new Builder: %v", err)
} }
@ -115,7 +115,7 @@ func TestPlugin(t *testing.T) {
} }
path := builder.GetPath() path := builder.GetPath()
if path != "/tmp/fake/pods/poduid/volumes/kubernetes.io~aws-pd/vol1" { if path != "/tmp/fake/pods/poduid/volumes/kubernetes.io~aws-ebs/vol1" {
t.Errorf("Got unexpected path: %s", path) t.Errorf("Got unexpected path: %s", path)
} }
@ -137,7 +137,7 @@ func TestPlugin(t *testing.T) {
} }
} }
cleaner, err := plug.(*awsPersistentDiskPlugin).newCleanerInternal("vol1", types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{}) cleaner, err := plug.(*awsElasticBlockStorePlugin).newCleanerInternal("vol1", types.UID("poduid"), &fakePDManager{}, &mount.FakeMounter{})
if err != nil { if err != nil {
t.Errorf("Failed to make a new Cleaner: %v", err) t.Errorf("Failed to make a new Cleaner: %v", err)
} }

View File

@ -29,9 +29,9 @@ import (
type AWSDiskUtil struct{} type AWSDiskUtil struct{}
// Attaches a disk specified by a volume.AWSPersistentDisk to the current kubelet. // Attaches a disk specified by a volume.AWSElasticBlockStore to the current kubelet.
// Mounts the disk to it's global path. // Mounts the disk to it's global path.
func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath string) error { func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsElasticBlockStore, globalPDPath string) error {
volumes, err := pd.getVolumeProvider() volumes, err := pd.getVolumeProvider()
if err != nil { if err != nil {
return err return err
@ -87,7 +87,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
} }
// Unmounts the device and detaches the disk from the kubelet's host machine. // Unmounts the device and detaches the disk from the kubelet's host machine.
func (util *AWSDiskUtil) DetachDisk(pd *awsPersistentDisk) error { func (util *AWSDiskUtil) DetachDisk(pd *awsElasticBlockStore) error {
// Unmount the global PD mount, which should be the only one. // Unmount the global PD mount, which should be the only one.
globalPDPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId) globalPDPath := makeGlobalPDPath(pd.plugin.host, pd.volumeId)
if err := pd.mounter.Unmount(globalPDPath, 0); err != nil { if err := pd.mounter.Unmount(globalPDPath, 0); err != nil {

View File

@ -273,7 +273,7 @@ func testPDPod(diskName, targetHost string, readOnly bool) *api.Pod {
{ {
Name: "testpd", Name: "testpd",
VolumeSource: api.VolumeSource{ VolumeSource: api.VolumeSource{
AWSPersistentDisk: &api.AWSPersistentDiskVolumeSource{ AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{
VolumeId: diskName, VolumeId: diskName,
FSType: "ext4", FSType: "ext4",
ReadOnly: readOnly, ReadOnly: readOnly,