How can i get the rollback_to info from the python api?

5/20/2020

Like the command :'kubectl rollout history deployments dep_name', I can get the revision list for this deployment, like something :

kubectl rollout history  deployment taudit
deployment.extensions/taudit
REVISION  CHANGE-CAUSE
1         <none>
2         <none>
3         <none>
4         <none>

I create the dep with :

k8s_apps_v1 = client.ExtensionsV1beta1Api()
        resp = k8s_apps_v1.create_namespaced_deployment

And I update the dep with:

k8s_apps_v1 = client.ExtensionsV1beta1Api()
        resp = k8s_apps_v1.replace_namespaced_deployment

And I use this Api to get the dep info:

k8s_apps_v1 = client.ExtensionsV1beta1Api()
    resp = k8s_apps_v1.list_namespaced_deployment(

But I get the rollback_to filed with value 'None'. As I show the info above, I have 4 revision for this dep actually. So, I not know how can i get the right info???

-- kami
kubectl
kubernetes
python-3.x

1 Answer

5/20/2020

help!!! The doc link : list_namespaced_deployment The api "" response model link is : ExtensionsV1beta1DeploymentList

And you can find the target filed by "items[i].spec.rollback_to".

-- kami
Source: StackOverflow