@@ -1101,7 +1101,6 @@ func (sc *syncContext) shouldUseServerSideApply(targetObj *unstructured.Unstruct
1101
1101
return sc .serverSideApply || resourceutil .HasAnnotationOption (targetObj , common .AnnotationSyncOptions , common .SyncOptionServerSideApply )
1102
1102
}
1103
1103
1104
- << << << < HEAD
1105
1104
// needsClientSideApplyMigration checks if a resource has fields managed by the specified manager
1106
1105
// that need to be migrated to the server-side apply manager
1107
1106
func (sc * syncContext ) needsClientSideApplyMigration (liveObj * unstructured.Unstructured , fieldManager string ) bool {
@@ -1148,10 +1147,8 @@ func (sc *syncContext) performClientSideApplyMigration(targetObj *unstructured.U
1148
1147
return nil
1149
1148
}
1150
1149
1151
- == == == =
1152
1150
// formatValue converts any value to its string representation with special handling for
1153
1151
// templates, maps, and strings. Returns "<nil>" for nil values.
1154
- >> >> >> > 3 df63b1 (refactor formatValue method to reduce complexity )
1155
1152
func formatValue (v any ) string {
1156
1153
if v == nil {
1157
1154
return "<nil>"
@@ -1324,41 +1321,19 @@ func getImmutableFieldChanges(currentSpec, desiredSpec map[string]any) []string
1324
1321
1325
1322
// formatVolumeClaimChanges handles the special case of formatting changes to volumeClaimTemplates
1326
1323
func formatVolumeClaimChanges (currentVal , desiredVal any ) []string {
1327
- currentTemplates , ok := currentVal .([]any )
1328
- if ! ok {
1329
- return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
1330
- }
1331
-
1332
- desiredTemplates , ok := desiredVal .([]any )
1333
- if ! ok {
1334
- return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
1335
- }
1324
+ currentTemplates := currentVal .([]any )
1325
+ desiredTemplates := desiredVal .([]any )
1336
1326
1337
1327
if len (currentTemplates ) != len (desiredTemplates ) {
1338
1328
return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
1339
1329
}
1340
1330
1341
1331
var changes []string
1342
1332
for i := range desiredTemplates {
1343
- desiredTemplate , ok := desiredTemplates [i ].(map [string ]any )
1344
- if ! ok {
1345
- continue
1346
- }
1347
- currentTemplate , ok := currentTemplates [i ].(map [string ]any )
1348
- if ! ok {
1349
- continue
1350
- }
1351
-
1352
- // Extract just the template name without storage size
1353
- metadata , ok := desiredTemplate ["metadata" ].(map [string ]any )
1354
- if ! ok {
1355
- continue
1356
- }
1357
- name , ok := metadata ["name" ].(string )
1358
- if ! ok || name == "" {
1359
- continue
1360
- }
1333
+ desiredTemplate := desiredTemplates [i ].(map [string ]any )
1334
+ currentTemplate := currentTemplates [i ].(map [string ]any )
1361
1335
1336
+ name := desiredTemplate ["metadata" ].(map [string ]any )["name" ].(string )
1362
1337
desiredStorage := getTemplateStorage (desiredTemplate )
1363
1338
currentStorage := getTemplateStorage (currentTemplate )
1364
1339
0 commit comments