fix bug in dynamicResourceClient.UpdateStatus should encode

pull/8/head
xuzhonghu 2018-04-27 14:07:11 +08:00
parent 393324497f
commit 9e8ce9535d
1 changed files with 11 additions and 5 deletions

View File

@ -158,8 +158,17 @@ func (c *dynamicResourceClient) UpdateStatus(obj *unstructured.Unstructured) (*u
return nil, err
}
result := c.client.client.Put().AbsPath(append(c.makeURLSegments(accessor.GetName()), "status")...).Body(obj).Do()
uncastObj, err := result.Get()
outBytes, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
if err != nil {
return nil, err
}
result := c.client.client.Put().AbsPath(append(c.makeURLSegments(accessor.GetName()), "status")...).Body(outBytes).Do()
retBytes, err := result.Raw()
if err != nil {
return nil, err
}
uncastObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, retBytes)
if err != nil {
return nil, err
}
@ -167,9 +176,6 @@ func (c *dynamicResourceClient) UpdateStatus(obj *unstructured.Unstructured) (*u
}
func (c *dynamicResourceClient) Delete(name string, opts *metav1.DeleteOptions) error {
if opts == nil {
opts = &metav1.DeleteOptions{}
}
if opts == nil {
opts = &metav1.DeleteOptions{}
}