Open tliron opened 2 years ago
I would be supportive of this proposal, as long as we mandate that each imported TOSCA service template should be valid when used stand-alone. Specifically, this means that one imported TOSCA file is not allowed to reference node templates by name that are not defined in the same TOSCA file.
@lauwers proposes the constraint 'should be valid when used stand-alone'. I suggest this would better be expressed as 'valid when considdered in isolation'. - Not every TOSCA template can be 'used' stand-alone but every TOSCA template should be valid.
Yes @pmjordan , that is a much better articulation. Thanks!
This tentative proposal is to allow a TOSCA file import tree to contain more than one file with a
service_template
keyname.The obvious implication is that the final collection of entities will merge these separate definitions together. For example, the final
node_templates
collection will contain allnode_templates
in the tree, wherever they are defined. The finaloutputs
will contain alloutputs
in the tree, wherever the are defined. As with types (node types, policy types, etc.) names must be unique and a name collision should be a syntax error. (An exception ispolicies
, discussed below.)Rationale:
imports
feature seems reasonable and straightforward.imports
.imports
can be preferable to copying-and-pasting. Note that that part of the topology might come with its owninputs
andoutputs
that would also be merged into the final service.Alternative solutions and considerations:
imports
to be used in this way we are potentially introducing another way to compose a service, moreover one that is entirely a design-time feature. Would this be confusing to users? I think not.imports
is a very easy-to-understand concept. I don't think anybody would mistake it for deployment-time service compositions. Moreover, for some use cases deployment-time service composition might be unnecessary, because the relevant aspect of the topology is entirely determined by designers, and this thus would provide a much more straightforward and deterministic solution.Some implications:
imports
doesn't apply to these names. For example, if there is a node template namedbackup-host
somewhere in the import tree, that would be its name, period. Thus designers have to be careful about name collisions, but this is very easy to verify via a simple design-time parsing tool.policies
is a bit different because it's a sequenced list rather than a map. Here we must have a more subtle merging rule. I propose that imported policies get simply appended after the current list. For example, if a TOSCA file defines 3 policies, and it also imports another file that has 2 policies, those 2 policies will be appended after the locally defined 3. This rule can be applied recursively.service_template
keyname exist in the root TOSCA file of a service. As long as templates are defined somewhere in the import tree, then they exist and that should suffice. (This does raise an interesting question, though: Should it be possible to define a service with no node templates at all? I don't see why not. Even right now we can create aservice_template
with no node templates.)