Provide custom Heat templates for each service in Trove

Registered by Denis M. on 2013-10-03

Provide custom heat templates for each service.
There is a need to provide and store custom templates for provisioning.

Make it pluggable for easy import on the fly.

https://gist.github.com/crazymac/6812917

Suppose we want to provide custom heat template for specific service type.
Now trove uses only one heat template for VM pre-configuration and guestagent launching.

-----------------------------------------------------------------------------------------

We should provide dependency between service(mysql, percona, mongo, redis, cassandra)
and specific heat template.

Also, we should externalize heat template from trove.common.template
to trove.extensions.service."service_type".template_module
-----------------------------------------------------------------------------------------

This is what Trove does now:
heat_template = template.HeatTemplate().template()
        parameters = {"KeyName": "heatkey",
                      "Flavor": flavor["name"],
                      "VolumeSize": volume_size,
                      "ServiceType": "mysql",
                      "InstanceId": self.id,
                      "AvailabilityZone": availability_zone}
        stack_name = 'trove-%s' % self.id
        stack = client.stacks.create(stack_name=stack_name,
                                     template=heat_template,
                                     parameters=parameters)
        stack = client.stacks.get(stack_name)
-----------------------------------------------------------------------------------------
What it should do:
This is what Trove does now:
service_template_class =
 utils.import_class('trove.extension.service.%d.template'
      % service_type)
service_template = service_template_class()
if hasattr(service_template, 'get_template'):
 heat_template = service_template.get_template()
         parameters = {"KeyName": "heatkey",
                       "Flavor": flavor["name"],
                       "VolumeSize": volume_size,
                       "ServiceType": "mysql",
                       "InstanceId": self.id,
                       "AvailabilityZone": availability_zone}
         stack_name = 'trove-%s' % self.id
         stack = client.stacks.create(stack_name=stack_name,
                                      template=service_template,
                                      parameters=parameters)
         stack = client.stacks.get(stack_name)

Or, at least, store heat templates in separate 'service'-template.yaml files and when it needed should be loaded and pushed to stack creation. But (!!!) there is should be responsible class that handles what parameters should be injected while stack creation.

Let's keep templates in etc/heat_templates
1 per service single instance, 1 per service cluster.

Workflow:
By service type loading custom class which perform look-up at etc/heat_templates for specific template.
Loading template as simple string (or yaml document) than passing it to stack creation.

Blueprint information

Status:
Complete
Approver:
Michael Basnight
Priority:
Essential
Drafter:
Michael Basnight
Direction:
Needs approval
Assignee:
yogesh-mehra
Definition:
Approved
Series goal:
Accepted for icehouse
Implementation:
Implemented
Milestone target:
milestone icon 2014.1
Started by
Denis M. on 2013-10-03
Completed by
Denis M. on 2013-11-19

Related branches

Sprints

Whiteboard

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.