Upgrading a Service with API v2

I am trying to upgrade a service using the the v2-beta API. The end goal is to simply pull a docker image and deploy it without changing any configurations on the service. Is there a simple way to do this? I was leaning toward having to send the entire service configuration in the body under “inServiceUpgradeStrategy” on the upgrade service request, but that seems crazy to have to do that on each request if I want to preserve the launch configuration I have already set in the UI.

Any help would be awesome!

Hi @chrisp!

I did it a few days ago. You can send only the values you want to change in the inServiceStrategy of your request. No need to specify all the launchConfig. Although its not crazy to get the launchConfig from the current service, change what you need and send the entire config again. The server will handle applying only the diff.

This is the reference you need:
http://rancher.com/docs/rancher/v1.6/en/api/v2-beta/api-resources/service/#upgrade

Thanks.

Ah ok, thanks @vkruoso! Do you also happen to know if you can tell it to finish and upgrade in the upgrade request so I don’t have to make two API calls to upgrade and finish and upgrade of a service?

No, finish is a separate call.

(In Rancher 2.0 it will not be needed anymore, the service will just go back to active, you can rollback if needed, and the old containers are garbage collected eventually or there’s an action to clean them up)

1 Like