Skip to content

Commit eef3d1f

Browse files
committed
Add webhook to make SourceVolumeMode immutable
1 parent eee5b4b commit eef3d1f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/validation-webhook/snapshot.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,5 +377,9 @@ func checkSnapshotContentImmutableFieldsV1(snapcontent, oldSnapcontent *volumesn
377377
if !reflect.DeepEqual(source.SnapshotHandle, oldSource.SnapshotHandle) {
378378
return fmt.Errorf("Spec.Source.SnapshotHandle is immutable but was changed from %s to %s", strPtrDereference(oldSource.SnapshotHandle), strPtrDereference(source.SnapshotHandle))
379379
}
380+
if !reflect.DeepEqual(snapcontent.Spec.SourceVolumeMode, oldSnapcontent.Spec.SourceVolumeMode) {
381+
return fmt.Errorf("Spec.SourceVolumeMode is immutable but was changed from %v to %v", *oldSnapcontent.Spec.SourceVolumeMode, *snapcontent.Spec.SourceVolumeMode)
382+
}
383+
380384
return nil
381385
}

0 commit comments

Comments
 (0)