@@ -197,50 +197,25 @@ func ValidateInfrastructureConfigUpdate(oldConfig, newConfig *apisaws.Infrastruc
197197 newZones = newConfig .Networks .Zones
198198 )
199199
200- // TODO: @hebelsan remove check after duplicate zones got migrated
201- if ! removedDuplicateZones (oldZones , newZones ) {
202- if len (oldZones ) > len (newZones ) {
203- allErrs = append (allErrs , field .Forbidden (field .NewPath ("networks.zones" ), "removing zones is not allowed" ))
204- return allErrs
205- }
206-
207- for i , oldZone := range oldZones {
208- idxPath := field .NewPath ("networks.zones" ).Index (i )
209- allErrs = append (allErrs , apivalidation .ValidateImmutableField (oldZone .Name , newConfig .Networks .Zones [i ].Name , idxPath .Child ("name" ))... )
210- allErrs = append (allErrs , apivalidation .ValidateImmutableField (oldZone .Public , newConfig .Networks .Zones [i ].Public , idxPath .Child ("public" ))... )
211- allErrs = append (allErrs , apivalidation .ValidateImmutableField (oldZone .Internal , newConfig .Networks .Zones [i ].Internal , idxPath .Child ("internal" ))... )
212- allErrs = append (allErrs , apivalidation .ValidateImmutableField (oldZone .Workers , newConfig .Networks .Zones [i ].Workers , idxPath .Child ("workers" ))... )
213- }
200+ if len (oldZones ) > len (newZones ) {
201+ allErrs = append (allErrs , field .Forbidden (field .NewPath ("networks.zones" ), "removing zones is not allowed" ))
202+ return allErrs
214203 }
215204
205+ for i , oldZone := range oldZones {
206+ idxPath := field .NewPath ("networks.zones" ).Index (i )
207+ allErrs = append (allErrs , apivalidation .ValidateImmutableField (newConfig .Networks .Zones [i ].Name , oldZone .Name , idxPath .Child ("name" ))... )
208+ allErrs = append (allErrs , apivalidation .ValidateImmutableField (newConfig .Networks .Zones [i ].Public , oldZone .Public , idxPath .Child ("public" ))... )
209+ allErrs = append (allErrs , apivalidation .ValidateImmutableField (newConfig .Networks .Zones [i ].Internal , oldZone .Internal , idxPath .Child ("internal" ))... )
210+ allErrs = append (allErrs , apivalidation .ValidateImmutableField (newConfig .Networks .Zones [i ].Workers , oldZone .Workers , idxPath .Child ("workers" ))... )
211+ }
216212 if oldConfig .DualStack != nil && oldConfig .DualStack .Enabled && (newConfig .DualStack == nil || ! newConfig .DualStack .Enabled ) {
217213 dualStackPath := field .NewPath ("dualStack.enabled" )
218214 allErrs = append (allErrs , field .Forbidden (dualStackPath , "field can't be changed from \" true\" to \" false\" " ))
219215 }
220216 return allErrs
221217}
222218
223- // removeDuplicateZones checks if duplicate zones got removed from the old
224- // TODO: @hebelsan remove after duplicate zones got migrated
225- func removedDuplicateZones (old []apisaws.Zone , new []apisaws.Zone ) bool {
226- // old must have more zones than new, otherwise we would not be able to remove duplicates
227- if len (old ) <= len (new ) {
228- return false
229- }
230-
231- oldZoneNames := sets .New [string ]()
232- for _ , zone := range old {
233- oldZoneNames .Insert (zone .Name )
234- }
235-
236- newZoneNames := sets .New [string ]()
237- for _ , zone := range new {
238- newZoneNames .Insert (zone .Name )
239- }
240-
241- return oldZoneNames .Equal (newZoneNames )
242- }
243-
244219var (
245220 reservedTagKeys = []string {"Name" }
246221 reservedTagKeyPrefixes = []string {
0 commit comments