title: Rollback the deployment using client-go api
body: <p>I would like to roll back the deployment to a certain revision( rollout history) using client-go library of k8s. But so far I havent found a solution. I could onyl fetch resource revision but not 'deployment revision' that I get using kebctl </p>
  
  <pre><code>kubectl rollout history deployment/nginx_dep
  </code></pre>
  
  <p>Here is the code using client-go api :</p>
  
  <pre><code>config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
  
  clientset, err := kubernetes.NewForConfig(config)
  
  dp, err := clientset.ExtensionsV1beta1Client.Deployments("default").Get("nginx-deployment", metav1.GetOptions{})
  </code></pre>
  
  <p><strong><em>Using client-go api:
  How do I get the existing revision for the given deployment.? I want to roll back the deployment to use this revision. Can anyone tell me how I should do that??</em></strong></p>
  
  <p>Here is the list of dependecies in my project:</p>
  
  <pre><code>[[constraint]]
    name = "k8s.io/client-go"
    version = "3.0.0"
  
  [[override]]
    name = "k8s.io/apimachinery"
    branch = "release-1.6"
  </code></pre>
  
  <p>Thank you in advance</p>