Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to change the etcd volume type and iops #10461

Merged
merged 1 commit into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions pkg/apis/kops/validation/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down
39 changes: 34 additions & 5 deletions upup/pkg/fi/cloudup/awstasks/ebsvolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}

Expand Down