Setting restartPolicy to "Never" through Rancher API


I would like to deploy workloads through the Rancher API. Once the job/container has finished it should not restart, but will be cleared through another process that checks the state of the workload.

Unfortunately, it doesn’t seem to be possible. If I set the restartPolicy to “Never” I’ll get this error:

spec.template.spec.restartPolicy: Unsupported value: “Never”: supported values: “Always”

Any idea how to solve this? In Rancher 1.6 this is possible and I guess/hope that it’s still possible to deploy something to Rancher 2.0 which doesn’t automatically restart.


I figured it out. If anyone else ever comes across this question, you’ll have to pass a jobConfig, then the workload will be of type “job” and have a restartPolicy of “Never”.