mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
make thirdparty codec able to decode DeleteOptions
This commit is contained in:
parent
de55e68a95
commit
6534661a04
@ -370,6 +370,10 @@ func (t *thirdPartyResourceDataDecoder) Decode(data []byte, gvk *schema.GroupVer
|
|||||||
}
|
}
|
||||||
return o, outGVK, nil
|
return o, outGVK, nil
|
||||||
default:
|
default:
|
||||||
|
if gvk != nil && registered.IsThirdPartyAPIGroupVersion(gvk.GroupVersion()) {
|
||||||
|
// delegate won't recognize a thirdparty group version
|
||||||
|
gvk = nil
|
||||||
|
}
|
||||||
return t.delegate.Decode(data, gvk, into)
|
return t.delegate.Decode(data, gvk, into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,15 @@ var _ = Describe("ThirdParty resources [Flaky] [Disruptive]", func() {
|
|||||||
framework.Failf("expected: %#v, saw in list: %#v", foo, list.Items[0])
|
framework.Failf("expected: %#v, saw in list: %#v", foo, list.Items[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := f.ClientSet.Extensions().RESTClient().Delete().AbsPath("/apis/company.com/v1/namespaces/default/foos/foo").DoRaw(); err != nil {
|
// Need to manually do the serialization because otherwise the
|
||||||
|
// Content-Type header is set to protobuf, the thirdparty codec in
|
||||||
|
// the API server side only accepts JSON.
|
||||||
|
deleteOptionsData, err := json.Marshal(v1.NewDeleteOptions(10))
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
if _, err := f.ClientSet.Core().RESTClient().Delete().
|
||||||
|
AbsPath("/apis/company.com/v1/namespaces/default/foos/foo").
|
||||||
|
Body(deleteOptionsData).
|
||||||
|
DoRaw(); err != nil {
|
||||||
framework.Failf("failed to delete: %v", err)
|
framework.Failf("failed to delete: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user