Skip to content

Commit c3032b7

Browse files
committed
fix test failures
Signed-off-by: Atif Ali <[email protected]>
1 parent 7f89f75 commit c3032b7

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

pkg/sync/sync_context.go

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,9 +1205,50 @@ func getImmutableFieldChanges(currentSpec, desiredSpec map[string]any) []string
12051205

12061206
// formatVolumeClaimChanges handles the special case of formatting changes to volumeClaimTemplates
12071207
func formatVolumeClaimChanges(currentVal, desiredVal any) []string {
1208-
// Special formatting for volumeClaimTemplates changes
1209-
// Shows storage size changes for each template
1210-
return []string{}
1208+
currentTemplates, ok := currentVal.([]any)
1209+
if !ok {
1210+
return []string{formatFieldChange("volumeClaimTemplates", currentVal, desiredVal)}
1211+
}
1212+
1213+
desiredTemplates, ok := desiredVal.([]any)
1214+
if !ok {
1215+
return []string{formatFieldChange("volumeClaimTemplates", currentVal, desiredVal)}
1216+
}
1217+
1218+
if len(currentTemplates) != len(desiredTemplates) {
1219+
return []string{formatFieldChange("volumeClaimTemplates", currentVal, desiredVal)}
1220+
}
1221+
1222+
var changes []string
1223+
for i := range desiredTemplates {
1224+
desiredTemplate, ok := desiredTemplates[i].(map[string]any)
1225+
if !ok {
1226+
continue
1227+
}
1228+
currentTemplate, ok := currentTemplates[i].(map[string]any)
1229+
if !ok {
1230+
continue
1231+
}
1232+
1233+
// Extract just the template name without storage size
1234+
metadata, ok := desiredTemplate["metadata"].(map[string]any)
1235+
if !ok {
1236+
continue
1237+
}
1238+
name, ok := metadata["name"].(string)
1239+
if !ok || name == "" {
1240+
continue
1241+
}
1242+
1243+
desiredStorage := getTemplateStorage(desiredTemplate)
1244+
currentStorage := getTemplateStorage(currentTemplate)
1245+
1246+
if currentStorage != desiredStorage {
1247+
changes = append(changes, fmt.Sprintf(" - volumeClaimTemplates.%s:\n from: %q\n to: %q",
1248+
name, currentStorage, desiredStorage))
1249+
}
1250+
}
1251+
return changes
12111252
}
12121253

12131254
func (sc *syncContext) applyObject(t *syncTask, dryRun, validate bool) (common.ResultCode, string) {

0 commit comments

Comments
 (0)