Enable TOSCA to be able to generate other target languages

Registered by Julio Ruano

Currently TOSCA only provides a translation service to the target HOT language. With the emergence of containers, there are now use cases where the direct translation of TOSCA to specific container orchestration engines (Kubernetes, Swarm, Nulecule, etc...) is useful. This blueprint serves to capture the intent to allow the translator component to be flexible enough that plugins can be provided in order to provide translation support for these additional platforms.

Blueprint information

Status:
Not started
Approver:
Sahdev Zala
Priority:
Low
Drafter:
Julio Ruano
Direction:
Needs approval
Assignee:
None
Definition:
Discussion
Series goal:
None
Implementation:
Not started
Milestone target:
None

Related branches

Sprints

Whiteboard

Specifically, the translator will need to provide plugin entry points to be configured through the new global configuration capability:
https://blueprints.launchpad.net/heat-translator/+spec/dynamic-tosca-to-hot-map
The following configuration option would need to be added, "target_language"

It should also allow for the management of the plugin code via the supported stevedore python library.

From a design perspective, this will require a common base class for the main translate modules:
translate_inputs.py
translate_node_templates.py
translate_outputs.py

Each will derive from a base class that generalizes the interface for the specific implementations, most likely the translate() method. Organizing the code should also enforce this plugin design. For example:

heat-translator/
    contrib/
        k8s/ (i.e. kubernetes specific implementation)
            translate_inputs.py
            translate_node_templates.py
            translate_outputs.py
        swarm/ (i.e. swarm specific implementation)
            translate_inputs.py
            translate_node_templates.py
            translate_outputs.py
    translator/
        hot/ (default hot specific implementation)
            translate_inputs.py
            translate_node_templates.py
            translate_outputs.py
        tosca_translator.py (main translator entry point, general)

Deliverables for this blueprint include the following:
- Reorganization of code to enforce plugin design
- Development of a base class to generalize the translation interface and allow for specialization supporting different target languages through derived classes. Fix existing code to use these new common base classes
- Addition of configuration option to specify correct target_language
- Code to leverage a plugin manager (stevedore) in order to load appropriate language translation classes (specified in configuration). Initial implementation of this blueprint will be to default to current HOT translation code, and to allow the ability to switch to something like kubernetes. Implementation for new target language is out of scope for this blueprint.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.