Skip to content

Change the order the different versions of API are registered #7629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2015

Conversation

caesarxuchao
Copy link
Contributor

Register the API versions to the DefaultRESTMapper in the order of preferred versions first.

This makes kubectl sends requests to URLs in the format defined by the latest version of API, thus fixing #7512, #7260, and #7491

@j3ffml
Copy link
Contributor

j3ffml commented May 1, 2015

cc @bgrant0607

@smarterclayton
Copy link
Contributor

LGTM

@@ -73,10 +73,10 @@ func TestInterfacesFor(t *testing.T) {

func TestRESTMapper(t *testing.T) {
// TODO: This test does not seem right. The version returned here depends on the order in which API versions were registered. This will just return the API version that was registered first. Fix this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this TODO

@caesarxuchao
Copy link
Contributor Author

Hi @smarterclayton, the shippable fails because the test-cmd.sh fails. These lines cause the problem:

if [[ "${version}" != "v1beta3" ]]; then
    kube::log::status "Testing kubectl(${version}:minions)"
    kube::test::get_object_assert minions "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
...

It's called when ${version} = "". I think the nil version means the default version, which is now v1beta3. So I guess we should modify the script to skip the minions test when version is nil. Am I right? Thanks.

@nikhiljindal
Copy link
Contributor

Yes. You can change that if condition to

  if [ "${version}" = "v1beta1" ] || [ "${version}" = "v1beta2" ]; then

@caesarxuchao
Copy link
Contributor Author

Hi @smarterclayton , just out of curious, what does this line do in test-cmd.sh?

[ "$(kubectl get minions -t $'{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ]

Why is there a $ sign before the template "$'{{ .apiVersion }}'"? And where is the test result used? I searched for "$?" but there is none. I know very little about bash..

@smarterclayton
Copy link
Contributor

Correct, now that v1beta3 is the default the empty API version will not have minions as the default name.

On May 1, 2015, at 5:53 PM, Chao Xu [email protected] wrote:

Hi @smarterclayton, the shippable fails because the test-cmd.sh fails. These lines cause the problem:

if [[ "${version}" != "v1beta3" ]]; then
kube::log::status "Testing kubectl(${version}:minions)"
kube::test::get_object_assert minions "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
...
It's called when ${version} = "". I think the nil version means the default version, which is now v1beta3. So I guess we should modify the script to skip the minions test when version is nil. Am I right? Thanks.


Reply to this email directly or view it on GitHub.

@smarterclayton
Copy link
Contributor

That's a great question I believe that might be the result of a copy and paste bug - I don't think that $ should be there.

On May 1, 2015, at 5:59 PM, Chao Xu [email protected] wrote:

Hi @smarterclayton , just out of curious, I have an irrelevant question about the test-cmd.sh. What does this line do?

[ "$(kubectl get minions -t $'{{ .apiVersion }}' "${kube_flags[@]}")" == "v1beta3" ]
Why is there a $ sign before the template "$'{{ .apiVersion }}'"? And where is the test result used? I searched for "$?" but there is none. I know very little about bash..


Reply to this email directly or view it on GitHub.

…eferred versions first.

This makes kubectl sends requests to URLs in the format defined by the latest API version.
@caesarxuchao
Copy link
Contributor Author

Hi @smarterclayton, the PR passes the shippable, could you merge it? Thanks.

@smarterclayton
Copy link
Contributor

Rerunning travis

@smarterclayton
Copy link
Contributor

LGTM

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2015
smarterclayton added a commit that referenced this pull request May 4, 2015
Change the order the different versions of API are registered
@smarterclayton smarterclayton merged commit dd81842 into kubernetes:master May 4, 2015
@bgrant0607 bgrant0607 mentioned this pull request May 28, 2015
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants