mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #37328 from caesarxuchao/fix-tpr-deleteoptions
Automatic merge from submit-queue (batch tested with PRs 37328, 38102, 37261, 31321, 38146) Make thirdparty codec able to decode DeleteOptions Fix #37278. Without this PR, the gvk sent to the delegated codec will be the thirdparty one, which is not recognized by the delegated codec (usually api.Codecs).
This commit is contained in:
commit
b1dba6cd9f
@ -370,6 +370,10 @@ func (t *thirdPartyResourceDataDecoder) Decode(data []byte, gvk *schema.GroupVer
|
||||
}
|
||||
return o, outGVK, nil
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,15 @@ var _ = Describe("ThirdParty resources [Flaky] [Disruptive]", func() {
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user