Skip to content

Commit 7020737

Browse files
authored
Merge pull request #580 from jgehrcke/jp/backport-579
[backport] Ignore unknown fields when decoding checkpoint JSON
2 parents 8e67cf2 + 6e21226 commit 7020737

File tree

1 file changed

+8
-1
lines changed
  • api/nvidia.com/resource/v1beta1

1 file changed

+8
-1
lines changed

api/nvidia.com/resource/v1beta1/api.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ func init() {
6969
scheme,
7070
scheme,
7171
json.SerializerOptions{
72-
Pretty: true, Strict: true,
72+
// Note: the strictness applies to all types defined above via
73+
// AddKnownTypes(), i.e. it cannot be set per-type. That is OK in
74+
// this case. Unknown fields will simply be dropped (ignored) upon
75+
// decode, which is what we want. This is relevant in a downgrade
76+
// case, when a checkpointed JSON document contains fields added in
77+
// a later version (workload defined with a new version of this
78+
// driver).
79+
Pretty: true, Strict: false,
7380
},
7481
)
7582
}

0 commit comments

Comments
 (0)