Skip to content

Commit ec14fa1

Browse files
committed
Ignore unknown fields when decoding checkpoint JSON
Signed-off-by: Dr. Jan-Philip Gehrcke <[email protected]>
1 parent 99d4278 commit ec14fa1

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)