@@ -1110,7 +1110,6 @@ func (sc *syncContext) shouldUseServerSideApply(targetObj *unstructured.Unstruct
1110
1110
return sc .serverSideApply || resourceutil .HasAnnotationOption (targetObj , common .AnnotationSyncOptions , common .SyncOptionServerSideApply )
1111
1111
}
1112
1112
1113
- << << << < HEAD
1114
1113
// needsClientSideApplyMigration checks if a resource has fields managed by the specified manager
1115
1114
// that need to be migrated to the server-side apply manager
1116
1115
func (sc * syncContext ) needsClientSideApplyMigration (liveObj * unstructured.Unstructured , fieldManager string ) bool {
@@ -1157,10 +1156,8 @@ func (sc *syncContext) performClientSideApplyMigration(targetObj *unstructured.U
1157
1156
return nil
1158
1157
}
1159
1158
1160
- == == == =
1161
1159
// formatValue converts any value to its string representation with special handling for
1162
1160
// templates, maps, and strings. Returns "<nil>" for nil values.
1163
- >> >> >> > 3 df63b1 (refactor formatValue method to reduce complexity )
1164
1161
func formatValue (v any ) string {
1165
1162
if v == nil {
1166
1163
return "<nil>"
@@ -1333,41 +1330,19 @@ func getImmutableFieldChanges(currentSpec, desiredSpec map[string]any) []string
1333
1330
1334
1331
// formatVolumeClaimChanges handles the special case of formatting changes to volumeClaimTemplates
1335
1332
func 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 )
1345
1335
1346
1336
if len (currentTemplates ) != len (desiredTemplates ) {
1347
1337
return []string {formatFieldChange ("volumeClaimTemplates" , currentVal , desiredVal )}
1348
1338
}
1349
1339
1350
1340
var changes []string
1351
1341
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 )
1370
1344
1345
+ name := desiredTemplate ["metadata" ].(map [string ]any )["name" ].(string )
1371
1346
desiredStorage := getTemplateStorage (desiredTemplate )
1372
1347
currentStorage := getTemplateStorage (currentTemplate )
1373
1348
0 commit comments