@@ -1110,7 +1110,6 @@ func (sc *syncContext) shouldUseServerSideApply(targetObj *unstructured.Unstruct
11101110 return sc .serverSideApply || resourceutil .HasAnnotationOption (targetObj , common .AnnotationSyncOptions , common .SyncOptionServerSideApply )
11111111}
11121112
1113- << << << < HEAD
11141113// needsClientSideApplyMigration checks if a resource has fields managed by the specified manager
11151114// that need to be migrated to the server-side apply manager
11161115func (sc * syncContext ) needsClientSideApplyMigration (liveObj * unstructured.Unstructured , fieldManager string ) bool {
@@ -1157,10 +1156,8 @@ func (sc *syncContext) performClientSideApplyMigration(targetObj *unstructured.U
11571156 return nil
11581157}
11591158
1160- == == == =
11611159// formatValue converts any value to its string representation with special handling for
11621160// templates, maps, and strings. Returns "<nil>" for nil values.
1163- >> >> >> > 3 df63b1 (refactor formatValue method to reduce complexity )
11641161func formatValue (v any ) string {
11651162 if v == nil {
11661163 return "<nil>"
@@ -1333,41 +1330,19 @@ func getImmutableFieldChanges(currentSpec, desiredSpec map[string]any) []string
13331330
13341331// formatVolumeClaimChanges handles the special case of formatting changes to volumeClaimTemplates
13351332func formatVolumeClaimChanges (currentVal , desiredVal any ) []string {
1336- currentTemplates , ok := currentVal .([]any )
1337- if ! ok {
1338- return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
1339- }
1340-
1341- desiredTemplates , ok := desiredVal .([]any )
1342- if ! ok {
1343- return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
1344- }
1333+ currentTemplates := currentVal .([]any )
1334+ desiredTemplates := desiredVal .([]any )
13451335
13461336 if len (currentTemplates ) != len (desiredTemplates ) {
13471337 return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
13481338 }
13491339
13501340 var changes []string
13511341 for i := range desiredTemplates {
1352- desiredTemplate , ok := desiredTemplates [i ].(map [string ]any )
1353- if ! ok {
1354- continue
1355- }
1356- currentTemplate , ok := currentTemplates [i ].(map [string ]any )
1357- if ! ok {
1358- continue
1359- }
1360-
1361- // Extract just the template name without storage size
1362- metadata , ok := desiredTemplate ["metadata" ].(map [string ]any )
1363- if ! ok {
1364- continue
1365- }
1366- name , ok := metadata ["name" ].(string )
1367- if ! ok || name == "" {
1368- continue
1369- }
1342+ desiredTemplate := desiredTemplates [i ].(map [string ]any )
1343+ currentTemplate := currentTemplates [i ].(map [string ]any )
13701344
1345+ name := desiredTemplate ["metadata" ].(map [string ]any )["name" ].(string )
13711346 desiredStorage := getTemplateStorage (desiredTemplate )
13721347 currentStorage := getTemplateStorage (currentTemplate )
13731348
0 commit comments