@@ -28,7 +28,6 @@ const (
2828 testAvailabilityZone = "us-west-2b"
2929 testSubnetID = "subnet-test123456"
3030 testSecurityGroupID = "sg-test123456"
31- testVolumeSize = int64 (120 )
3231 testCapacityReservationID = "cr-test123456"
3332
3433 // VAP error messages - from actual VAP policy
@@ -139,6 +138,39 @@ var _ = Describe("[sig-cluster-lifecycle][OCPFeatureGate:MachineAPIMigration] MA
139138 })
140139 })
141140
141+ Context ("AWS provider spec field restrictions" , func () {
142+ It ("should prevent updating providerSpec.instanceType" , func () {
143+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "instanceType" , testInstanceType , vapSpecLockedMessage )
144+ })
145+
146+ It ("should prevent updating providerSpec.amiID" , func () {
147+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "amiID" , testAMIID , vapSpecLockedMessage )
148+ })
149+
150+ It ("should prevent updating providerSpec.availabilityZone" , func () {
151+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "availabilityZone" , testAvailabilityZone , vapSpecLockedMessage )
152+ })
153+
154+ It ("should prevent updating providerSpec.subnetID" , func () {
155+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "subnetID" , testSubnetID , vapSpecLockedMessage )
156+ })
157+
158+ It ("should prevent updating providerSpec.securityGroups" , func () {
159+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "securityGroups" , testSecurityGroupID , vapSpecLockedMessage )
160+ })
161+
162+ It ("should prevent updating providerSpec.tags" , func () {
163+ testTags := map [string ]string {
164+ "test-key" : "test-value" ,
165+ }
166+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "tags" , testTags , vapSpecLockedMessage )
167+ })
168+
169+ It ("should prevent updating providerSpec.capacityReservationId" , func () {
170+ verifyAWSProviderSpecUpdatePrevented (testMAPIMachine , "capacityReservationId" , testCapacityReservationID , vapSpecLockedMessage )
171+ })
172+ })
173+
142174 Context ("VAP match conditions verification" , func () {
143175 It ("should not apply VAP when authoritativeAPI is MachineAPI" , func () {
144176 verifyVAPNotAppliedForMachineAPIAuthority ()
@@ -207,24 +239,6 @@ func verifyAWSProviderSpecUpdatePrevented(machine *mapiv1beta1.Machine, fieldNam
207239 providerSpec .SecurityGroups = []mapiv1beta1.AWSResourceReference {{
208240 ID : & []string {testValue .(string )}[0 ],
209241 }}
210- case "volumeSize" :
211- if len (providerSpec .BlockDevices ) > 0 {
212- if providerSpec .BlockDevices [0 ].EBS != nil {
213- providerSpec .BlockDevices [0 ].EBS .VolumeSize = & []int64 {testValue .(int64 )}[0 ]
214- }
215- }
216- case "volumeType" :
217- if len (providerSpec .BlockDevices ) > 0 {
218- if providerSpec .BlockDevices [0 ].EBS != nil {
219- providerSpec .BlockDevices [0 ].EBS .VolumeType = & []string {testValue .(string )}[0 ]
220- }
221- }
222- case "encryption" :
223- if len (providerSpec .BlockDevices ) > 0 {
224- if providerSpec .BlockDevices [0 ].EBS != nil {
225- providerSpec .BlockDevices [0 ].EBS .Encrypted = & []bool {testValue .(bool )}[0 ]
226- }
227- }
228242 case "tags" :
229243 // Convert map to TagSpecification slice
230244 tagMap := testValue .(map [string ]string )
0 commit comments