fix bug in dynamicResourceClient.UpdateStatus should encode

Kubernetes-commit: 9e8ce9535d9ce46791304e4ea3d1694e09b9ae9f
This commit is contained in:
xuzhonghu 2018-04-27 14:07:11 +08:00 committed by Kubernetes Publisher
parent e18ef65b0f
commit 2b0acf6f5a

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{}
}