1

I was able to rollback pod. However, I am not able to redeploy. Following is query.

curl -u "auth" -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"replicaSetId":null}' 'URL?action=rollback'

Is any one know how to do it ?

Kush Patel
  • 3,245
  • 5
  • 36
  • 60

1 Answers1

3

I agree it will be nice to have redeploy action in the API. But for now you can use the following workaround (taken from official rancher forum, but I fixed some headers due to errors):

pod_upgrade_body=$(curl -u "token-[use your token here]" \
-s 'https://rancher.mydomain.com/v3/project/c-zqpm5:p-h884r/workloads/deployment:development:api' \
-X GET \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' 2>&1 | sed  "s/\"cattle\.io\/timestamp\"\:\"[0-9T:Z-]*\"/\"cattle\.io\/timestamp\":\"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"/g")

curl -u "token-[use your token here]" \
-s 'https://rancher.mydomain.com/v3/project/c-zqpm5:p-h884r/workloads/deployment:development:api' \
-X PUT \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-binary "$pod_upgrade_body" --compressed 
Roman Podlinov
  • 21,508
  • 7
  • 38
  • 58