Use raw bytes in metav1.Fields instead of map

Also define custom proto unmarshaller that understands the old format
This commit is contained in:
jennybuckley
2019-07-31 16:05:48 -07:00
committed by Jennifer Buckley
parent b7649db53a
commit addad99b6f
9 changed files with 143 additions and 140 deletions

View File

@@ -789,40 +789,7 @@ func TestApplyConvertsManagedFieldsVersion(t *testing.T) {
APIVersion: "apps/v1",
Time: actual.Time,
Fields: &metav1.Fields{
Map: map[string]metav1.Fields{
"f:metadata": {
Map: map[string]metav1.Fields{
"f:labels": {
Map: map[string]metav1.Fields{
"f:sidecar_version": {Map: map[string]metav1.Fields{}},
},
},
},
},
"f:spec": {
Map: map[string]metav1.Fields{
"f:template": {
Map: map[string]metav1.Fields{
"f:spec": {
Map: map[string]metav1.Fields{
"f:containers": {
Map: map[string]metav1.Fields{
"k:{\"name\":\"sidecar\"}": {
Map: map[string]metav1.Fields{
".": {Map: map[string]metav1.Fields{}},
"f:image": {Map: map[string]metav1.Fields{}},
"f:name": {Map: map[string]metav1.Fields{}},
},
},
},
},
},
},
},
},
},
},
},
Raw: []byte(`{"f:metadata":{"f:labels":{"f:sidecar_version":{}}},"f:spec":{"f:template":{"f:spec":{"f:containers":{"k:{\"name\":\"sidecar\"}":{".":{},"f:image":{},"f:name":{}}}}}}}`),
},
}