This is current process for preforming a stack upgrade
go to github to get the catalog template data (e.g. the rancher and docker compose files)
determine what Rancher environments the service account has access to
determine if the existing Rancher stack is upgradeable based on source and target metadata information (e.g. external id in the existing stack against the uuid or the template from github
We can eliminate the first step entirely if we leverage Rancher's catalog API. Below is the proposed implementation. The order in which the steps are done can be reorder to whatever is the most efficient:
Update the PATCH /stack endpoint so that it accepts something like the following:
{
"catalog": "name of the catalog in Rancher",
"catalogTemplate": "the template that is going to be upgraded",
"catalogVersion": "the template version that the service should upgrade to
}
Leverage Rancher's Catalog API and do the following:
check if the template version exists in the catalog by inspecting the versionLinks object. This object contains key-value pairs in the form or "template version": "url to template"
if the version exists, follow the URL to get the version's id as well as it's docker and rancher compose data
Determine the environments that the stack can be upgraded in
Compare the externalId of the stack and the id of the template version to determine if the stack can be upgraded. The existing rules would still apply here.
Preform the upgrade with the rancher and docker compose data
I have validated the following:
You can view catalog information using access keys for a non-user admin
You can push a new catalog template version to Github and view it via the API without having to refresh the catalog in Rancher
This is current process for preforming a stack upgrade
We can eliminate the first step entirely if we leverage Rancher's catalog API. Below is the proposed implementation. The order in which the steps are done can be reorder to whatever is the most efficient:
/v1-catalog/templates/catalog-name:catalog-template
check if the template version exists in the catalog by inspecting the versionLinks object. This object contains key-value pairs in the form or "template version": "url to template"
if the version exists, follow the URL to get the version's id as well as it's docker and rancher compose data
Determine the environments that the stack can be upgraded in
Compare the externalId of the stack and the id of the template version to determine if the stack can be upgraded. The existing rules would still apply here.
Preform the upgrade with the rancher and docker compose data
I have validated the following: