Skip to content

Commit c2d88a2

Browse files
committed
fix test failures2
Signed-off-by: Atif Ali <[email protected]>
1 parent 488b379 commit c2d88a2

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

pkg/sync/sync_context.go

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,6 @@ func (sc *syncContext) shouldUseServerSideApply(targetObj *unstructured.Unstruct
11011101
return sc.serverSideApply || resourceutil.HasAnnotationOption(targetObj, common.AnnotationSyncOptions, common.SyncOptionServerSideApply)
11021102
}
11031103

1104-
<<<<<<< HEAD
11051104
// needsClientSideApplyMigration checks if a resource has fields managed by the specified manager
11061105
// that need to be migrated to the server-side apply manager
11071106
func (sc *syncContext) needsClientSideApplyMigration(liveObj *unstructured.Unstructured, fieldManager string) bool {
@@ -1148,10 +1147,8 @@ func (sc *syncContext) performClientSideApplyMigration(targetObj *unstructured.U
11481147
return nil
11491148
}
11501149

1151-
=======
11521150
// formatValue converts any value to its string representation with special handling for
11531151
// templates, maps, and strings. Returns "<nil>" for nil values.
1154-
>>>>>>> 3df63b1 (refactor formatValue method to reduce complexity)
11551152
func formatValue(v any) string {
11561153
if v == nil {
11571154
return "<nil>"
@@ -1324,41 +1321,19 @@ func getImmutableFieldChanges(currentSpec, desiredSpec map[string]any) []string
13241321

13251322
// formatVolumeClaimChanges handles the special case of formatting changes to volumeClaimTemplates
13261323
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)
13361326

13371327
if len(currentTemplates) != len(desiredTemplates) {
13381328
return []string{formatFieldChange("volumeClaimTemplates", currentVal, desiredVal)}
13391329
}
13401330

13411331
var changes []string
13421332
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)
13611335

1336+
name := desiredTemplate["metadata"].(map[string]any)["name"].(string)
13621337
desiredStorage := getTemplateStorage(desiredTemplate)
13631338
currentStorage := getTemplateStorage(currentTemplate)
13641339

0 commit comments

Comments
 (0)