Skip to content
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

v1beta1/create_namespaced_deployment_rollback #491

Closed
aogier opened this issue Mar 21, 2018 · 11 comments
Closed

v1beta1/create_namespaced_deployment_rollback #491

aogier opened this issue Mar 21, 2018 · 11 comments

Comments

@aogier
Copy link

aogier commented Mar 21, 2018

Hello, I'm getting some issues trying to rolling back a deployment because api-client response.

If I try to run an the examples' deployment script I'm getting this error during rollback:

Traceback (most recent call last):
  File "examples/notebooks/create_deployment.py", line 140, in <module>
    extension.create_namespaced_deployment_rollback(name="nginx-deployment", namespace="default", body=rollback)
  File "/home/oggei/dev/k8s-py/kubernetes/client/apis/extensions_v1beta1_api.py", line 273, in create_namespaced_deployment_rollback
    (data) = self.create_namespaced_deployment_rollback_with_http_info(name, namespace, body, **kwargs)
  File "/home/oggei/dev/k8s-py/kubernetes/client/apis/extensions_v1beta1_api.py", line 364, in create_namespaced_deployment_rollback_with_http_info
    collection_formats=collection_formats)
  File "/home/oggei/dev/k8s-py/kubernetes/client/api_client.py", line 321, in call_api
    _return_http_data_only, collection_formats, _preload_content, _request_timeout)
  File "/home/oggei/dev/k8s-py/kubernetes/client/api_client.py", line 163, in __call_api
    return_data = self.deserialize(response_data, response_type)
  File "/home/oggei/dev/k8s-py/kubernetes/client/api_client.py", line 236, in deserialize
    return self.__deserialize(data, response_type)
  File "/home/oggei/dev/k8s-py/kubernetes/client/api_client.py", line 276, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/home/oggei/dev/k8s-py/kubernetes/client/api_client.py", line 622, in __deserialize_model
    instance = klass(**kwargs)
  File "/home/oggei/dev/k8s-py/kubernetes/client/models/extensions_v1beta1_deployment_rollback.py", line 65, in __init__
    self.name = name
  File "/home/oggei/dev/k8s-py/kubernetes/client/models/extensions_v1beta1_deployment_rollback.py", line 137, in name
    raise ValueError("Invalid value for `name`, must not be `None`")
ValueError: Invalid value for `name`, must not be `None`

Tracing api calls, this is what is posted during rollback:

{
    "apiVersion": "extensions/v1beta1",
    "kind": "DeploymentRollback",
    "name": "nginx-deployment",
    "rollbackTo": {
        "revision": 0
    }
}

Response, a positive 201 Created, is:

{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Success",
    "message": "rollback request for deployment \"nginx-deployment\" succeeded",
    "code": 200
}

I don't think this could be related to rollbackTo deprecation in v1beta1, cause if I rollback via kubectl rollout undo as documented here I still get a similar chat (altough no revision in $.rollbackTo).

{
    "kind": "DeploymentRollback",
    "apiVersion": "extensions/v1beta1",
    "name": "nginx-deployment",
    "rollbackTo": {}
}
{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Success",
    "message": "rollback request for deployment \"nginx-deployment\" succeeded",
    "code": 200
}

I think the culprit is on swagger machinery but I don't know if it could be safe to work on this, or what else.

Any ideas ? Thank you, ciao !

@aogier
Copy link
Author

aogier commented Mar 22, 2018

Hi @tomplus, in this case we have name that isn't a list, so maybe the problem originate somewhere else. BTW suggested monkey patch will not work

@tomplus
Copy link
Member

tomplus commented Mar 22, 2018

Sorry, you are right. I've deleted my previous comment to remove the link from the attached issue.

It looks like bug in official API specification. Take a look - https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#rollback RollbackConfig should be returned but you get Status.

IMO you can create an issue here: https://github.com/kubernetes/kubernetes/

@aogier
Copy link
Author

aogier commented Mar 22, 2018

Hi, thank you for that great pointer I didn't noticed before !
I'll definitely produce a better trace of what's going on and then submit a k8s issue. For now I'll also leave this one open.

Thank you, regards !

@roycaihw
Copy link
Member

k8s PR tracked here: kubernetes/kubernetes#56591. Closing

@zq-david-wang
Copy link

The fix does not seem shipped into pip package, I have to use _preload_content=False to prevent client from parsing the response.
create_namespaced_deployment_rollback(name, namespace, body=body, _preload_content=False)

@nmohoric
Copy link

Yeah I'm still running into this as well, thanks for the tip to at least get around it for now @zq-david-wang

@roycaihw
Copy link
Member

The k8s openapi fix was merged after 1.11 and didn't get cherrypicked. Currently the latest python client (v7) is generated from k8s 1.11, so it still doesn't include the fix. We will release v8 after k8s 1.12 is released, and the client will include the fix.

@roycaihw
Copy link
Member

Actually I realized that the previous fix was wrong kubernetes/kubernetes#63837 (comment). I had another fix kubernetes/kubernetes#68864 and plan to cherrypick it to 1.12.1 (talked with 1.12 patch release manager-- 1.12.1 release will be roughly two weeks after 1.12.0 being cut).

@yliaog I plan to do an alpha release align with 1.12.0 and a beta release align with 1.12.1, assuming that we don't have more API change after beta release. WDYT?

@yliaog
Copy link
Contributor

yliaog commented Sep 20, 2018

that sounds good to me.

@Lawouach
Copy link

Hello,

I'm running into this issue as well with:

Python kubernetes==9.0.0

Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

Was there a fix for this one?

Cheers,

@Lawouach
Copy link

Oh, that was my bad. I was misusing the API! :(

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants