mirror of https://github.com/k3s-io/k3s
fix ParameterCodec for thirdparty resource
parent
e113aef9f0
commit
5b108acb38
|
@ -639,7 +639,7 @@ func (m *Master) thirdpartyapi(group, kind, version string) *apiserver.APIGroupV
|
|||
OptionsExternalVersion: &optionsExternalVersion,
|
||||
|
||||
Serializer: thirdpartyresourcedata.NewNegotiatedSerializer(api.Codecs, kind, externalVersion, internalVersion),
|
||||
ParameterCodec: api.ParameterCodec,
|
||||
ParameterCodec: thirdpartyresourcedata.NewThirdPartyParameterCodec(api.ParameterCodec),
|
||||
|
||||
Context: m.RequestContextMapper,
|
||||
|
||||
|
|
|
@ -21,12 +21,14 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/meta"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
apiutil "k8s.io/kubernetes/pkg/api/util"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
|
@ -364,3 +366,19 @@ func (t *thirdPartyResourceDataCreator) New(kind unversioned.GroupVersionKind) (
|
|||
return t.delegate.New(kind)
|
||||
}
|
||||
}
|
||||
|
||||
func NewThirdPartyParameterCodec(p runtime.ParameterCodec) runtime.ParameterCodec {
|
||||
return &thirdPartyParameterCodec{p}
|
||||
}
|
||||
|
||||
type thirdPartyParameterCodec struct {
|
||||
delegate runtime.ParameterCodec
|
||||
}
|
||||
|
||||
func (t *thirdPartyParameterCodec) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into runtime.Object) error {
|
||||
return t.delegate.DecodeParameters(parameters, v1.SchemeGroupVersion, into)
|
||||
}
|
||||
|
||||
func (t *thirdPartyParameterCodec) EncodeParameters(obj runtime.Object, to unversioned.GroupVersion) (url.Values, error) {
|
||||
return t.delegate.EncodeParameters(obj, v1.SchemeGroupVersion)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue