mirror of https://github.com/kubernetes/kops.git
Merge pull request #10461 from olemarkus/allow-modify-etcd-volume
Make it possible to change the etcd volume type and iops
This commit is contained in:
commit
2677254392
|
|
@ -105,14 +105,6 @@ func validateEtcdMemberUpdate(fp *field.Path, obj kops.EtcdMemberSpec, status *k
|
|||
allErrs = append(allErrs, field.Forbidden(fp.Child("instanceGroup"), "instanceGroup cannot be changed"))
|
||||
}
|
||||
|
||||
if fi.StringValue(obj.VolumeType) != fi.StringValue(old.VolumeType) {
|
||||
allErrs = append(allErrs, field.Forbidden(fp.Child("volumeType"), "volumeType cannot be changed"))
|
||||
}
|
||||
|
||||
if fi.Int32Value(obj.VolumeIops) != fi.Int32Value(old.VolumeIops) {
|
||||
allErrs = append(allErrs, field.Forbidden(fp.Child("volumeIops"), "volumeIops cannot be changed"))
|
||||
}
|
||||
|
||||
if fi.Int32Value(obj.VolumeSize) != fi.Int32Value(old.VolumeSize) {
|
||||
allErrs = append(allErrs, field.Forbidden(fp.Child("volumeSize"), "volumeSize cannot be changed"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,15 @@ func (_ *EBSVolume) CheckChanges(a, e, changes *EBSVolume) error {
|
|||
if changes.ID != nil {
|
||||
return fi.CannotChangeField("ID")
|
||||
}
|
||||
if changes.AvailabilityZone != nil {
|
||||
return fi.CannotChangeField("AvailabilityZone")
|
||||
}
|
||||
if changes.Encrypted != nil {
|
||||
return fi.CannotChangeField("Encrypted")
|
||||
}
|
||||
if changes.KmsKeyId != nil {
|
||||
return fi.CannotChangeField("KmsKeyId")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -163,13 +172,33 @@ func (_ *EBSVolume) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *EBSVolume) e
|
|||
return fmt.Errorf("error adding AWS Tags to EBS Volume: %v", err)
|
||||
}
|
||||
|
||||
if a != nil && len(a.Tags) > 0 {
|
||||
tagsToDelete := e.getEBSVolumeTagsToDelete(a.Tags)
|
||||
if len(tagsToDelete) > 0 {
|
||||
return t.DeleteTags(*e.ID, tagsToDelete)
|
||||
if a != nil {
|
||||
if len(changes.Tags) > 0 {
|
||||
tagsToDelete := e.getEBSVolumeTagsToDelete(a.Tags)
|
||||
if len(tagsToDelete) > 0 {
|
||||
return t.DeleteTags(*e.ID, tagsToDelete)
|
||||
}
|
||||
}
|
||||
|
||||
if changes.VolumeType != nil ||
|
||||
changes.VolumeIops != nil ||
|
||||
changes.VolumeThroughput != nil ||
|
||||
changes.SizeGB != nil {
|
||||
|
||||
request := &ec2.ModifyVolumeInput{
|
||||
VolumeId: a.ID,
|
||||
VolumeType: e.VolumeType,
|
||||
Iops: e.VolumeIops,
|
||||
Throughput: e.VolumeThroughput,
|
||||
Size: e.SizeGB,
|
||||
}
|
||||
|
||||
_, err := t.Cloud.EC2().ModifyVolume(request)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error modifying volume: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue