Repository navigation
Fix project request quota - #5454
Conversation
|
Before I finish updating unit tests, this is happening because the codec used for serializing the object is not the same as the codec used in the RESTClient for submission. This commit here deads2k@434636a would make it match. I'm hard pressed to think of a reason to know the correct codec for the URL we're POSTing to and not using it. @ironcladlou You had a similar problem during v1beta3 disablement, does this seem reasonable? |
There was a problem hiding this comment.
you can pass in a runtime.Object to Request.Body(), and it gets encoded using the RESTClient's codec, right? That seems preferable
There was a problem hiding this comment.
you can pass in a runtime.Object to Request.Body(), and it gets encoded using the RESTClient's codec, right? That seems preferable
For this case in particular, probably, but I'm disinclined to have a second spot where we build the URL unless you feel pretty strongly.
You agree on principle, but want a refactor of the method overall?
There was a problem hiding this comment.
I just don't like adding GetCodec() to the RESTClient interface... passing the object into Body lets you leave the responsibility for encoding in the RESTClient's hands
There was a problem hiding this comment.
I just don't like adding GetCodec() to the RESTClient interface... passing the object into Body lets you leave the responsibility for encoding in the RESTClient's hands
I don't like the sig func (m *Helper) Create(namespace string, modify bool, data []byte) either, but changing it to func (m *Helper) Create(namespace string, modify bool, data interface{}) is more that I'd really like to change here
There was a problem hiding this comment.
I don't like the sig func (m *Helper) Create(namespace string, modify bool, data []byte) either, but changing it to func (m *Helper) Create(namespace string, modify bool, data interface{}) is more that I'd really like to change here
Especially since someone (@smarterclayton) thought about this upstream and decided that passing through straight []byte was the proper way to build the API. They went to some effort to make that happen.
There was a problem hiding this comment.
so leave that alone for now and just refactor the internal createResource/replaceResource methods to take an interface{}, which lets you pass through the []byte, or pass the decoded runtime.Object when modify is true. The helper's codec then is only used for decoding in order to set resourceVersion when modify is true
There was a problem hiding this comment.
so leave that alone for now and just refactor the internal createResource/replaceResource methods to take an interface{}, which lets you pass through the []byte, or pass the decoded runtime.Object when modify is true. The helper's codec then is only used for decoding in order to set version when modify is true
That leaves me exposing GetCodec to make the rest work.
There was a problem hiding this comment.
That is the original pattern from the original implementation. It's never
been important enough to change.
On Wed, Oct 28, 2015 at 10:46 AM, David Eads [email protected]
wrote:
In Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/helper.go
#5454 (comment):@@ -117,7 +117,7 @@ func (m *Helper) Create(namespace string, modify bool, data []byte) (runtime.Obj
if err := m.Versioner.SetResourceVersion(obj, ""); err != nil {
return nil, err
}
newData, err := m.Codec.Encode(obj)newData, err := m.RESTClient.GetCodec().Encode(obj)I don't like the sig func (m *Helper) Create(namespace string, modify
bool, data []byte) either, but changing it to func (m *Helper)
Create(namespace string, modify bool, data interface{}) is more that I'd
really like to change hereEspecially since someone (@smarterclayton
https://github.com/smarterclayton) thought about this upstream and
decided that passing through straight []byte was the proper way to build
the API. They went to some effort to make that happen.—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/5454/files#r43264340.
d4f3e5d to
7f36aad
Compare
There was a problem hiding this comment.
I guess all the new-project calls test the default template well enough
|
[test] |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6315/) |
|
Evaluated for origin test up to 7f36aad |
|
Makes sense to me. It was never clear to me why it was necessary to sling []bytes and do decoding outside of the RESTClient. |
|
[merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6315/) (Image: devenv-rhel7_2589) |
|
Evaluated for origin merge up to 7f36aad |
Merged by openshift-bot
Bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1275001