Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/kapp/crdupgradesafety/change_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ func CalculateFlatSchemaDiff(o, n FlatSchema) (map[string]FieldDiff, error) {
// we should still detect changes in the children fields.
oldCopy := schema.DeepCopy()
newCopy := newSchema.DeepCopy()
oldCopy.Properties = nil
newCopy.Properties = nil
oldCopy.Properties, oldCopy.Items = nil, nil
newCopy.Properties, newCopy.Items = nil, nil
if !reflect.DeepEqual(oldCopy, newCopy) {
diffMap[field] = FieldDiff{
Old: oldCopy,
Expand Down
18 changes: 18 additions & 0 deletions pkg/kapp/crdupgradesafety/change_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,24 @@ func TestCalculateFlatSchemaDiff(t *testing.T) {
},
expectedDiff: map[string]crdupgradesafety.FieldDiff{},
},
{
name: "diff in child items only, no diff returned, no error",
old: crdupgradesafety.FlatSchema{
"foo": &v1.JSONSchemaProps{
Items: &v1.JSONSchemaPropsOrArray{Schema: &v1.JSONSchemaProps{
ID: "bar",
}},
},
},
new: crdupgradesafety.FlatSchema{
"foo": &v1.JSONSchemaProps{
Items: &v1.JSONSchemaPropsOrArray{Schema: &v1.JSONSchemaProps{
ID: "baz",
}},
},
},
expectedDiff: map[string]crdupgradesafety.FieldDiff{},
},
{
name: "field exists in old but not new, no diff returned, error",
old: crdupgradesafety.FlatSchema{
Expand Down
Loading