-
Notifications
You must be signed in to change notification settings - Fork 15
Template versioning support
This is a draft page describing the details if how templates are handled to enable template multi-version support on a peer.
Template can be referenced when importing/cloning in these ways:
subutai import foo
subutai import foo@tom
subutai import foo@tom:1.0.0
subutai import id:{template-id}
When using way (1), the template is searched within the verified templates only (belonging to user subutai). The latest version of the template is fetched.
If optional -t {CDN-TOKEN}
argument is passed, then the template is searched first within the user's own templates, then within the templates shared with the user, and, in the very end, it is searched within the verified templates.
When using way (2), the template is searched within the templates of user tom. The latest version of the template is fetched.
When using way (3), the template is searched within the templates of user tom. The specified version of the template is fetched.
When using way (3), the exact template is fetched.
Note: subutai clone
command also uses the same ways of specifying source templates for cloning.
Template can depend on parent templates. When installing a template, system also installs all parent templates.
The parent templates are referenced precisely using name@user:version
obtained from the child template's config file.
A template gets installed to the partition /var/snap/subutai/common/lxc
, namely to /var/snap/subutai/common/lxc/templates
. (Containers get installed to /var/snap/subutai/common/lxc/containers
).
Inside templates directory, a template is installed in the following path name/owner/version
.
For example, for template foo of owner tom and version 1.0.0, the full path would look like this:
/var/snap/subutai/common/lxc/templates/foo/tom/1.0.0
. This allows to have multiple versions of the same template installed in parallel, e.g.:
/var/snap/subutai/common/lxc/templates/foo/tom/1.0.0
/var/snap/subutai/common/lxc/templates/foo/tom/2.0.0
/var/snap/subutai/common/lxc/templates/foo/tom/3.0.0
Also this allows to have multiple identically named templates of different owners to be installed in parallel, e.g.:
/var/snap/subutai/common/lxc/templates/foo/tom/1.0.0
/var/snap/subutai/common/lxc/templates/foo/jerry/1.0.0
This simple directory structure allows tools to iterate over the installed templates and easily determine what templates of what versions/owners exist in the system.
To remove a template from the system, we use subutai destroy -t foo@tom:1.0.0
command.
We need to specify a full template reference.
If partial reference is specified, and there is only one template with such a name, it gets removed.
If partial reference is specified, and there are several template of different owners/versions then they are displayed to user and user is prompted to choose a particular template.