您的位置:首页 > 运维架构

OpenStack-Heat中template的formatversion介绍

2014-05-20 11:28 337 查看
template中有三个formatversion,第一种是aws的格式,表示这是一个json文件;第二种是heat为了扩展aws并且更好的加入注释,引入的yaml格式文件;第三种是openstack的heat特有的hot格式的头部,也是基于yaml格式的。

"AWSTemplateFormatVersion": "2010-09-09", 
HeatTemplateFormatVersion: '2012-12-12'
heat_template_version: 2013-05-23

不同版本所支持函数的区别

https://github.com/openstack/heat/blob/master/heat/engine/cfn/functions.py#L542):
'AWSTemplateFormatVersion' 支持的函数
            'Fn::FindInMap': FindInMap,
            'Fn::GetAZs': GetAZs,
            'Ref': Ref,
            'Fn::GetAtt': GetAtt,
            'Fn::Select': Select,
            'Fn::Join': Join,
            'Fn::Base64': Base64,

'HeatTemplateFormatVersion' 支持的函数
            'Fn::FindInMap': FindInMap,
            'Fn::GetAZs': GetAZs,
            'Ref': Ref,
            'Fn::GetAtt': GetAtt,
            'Fn::Select': Select,
            'Fn::Join': Join,
            'Fn::Split': Split,
            'Fn::Replace': Replace,
            'Fn::Base64': Base64,
            'Fn::MemberListToMap': MemberListToMap,
            'Fn::ResourceFacade': ResourceFacade,

https://github.com/openstack/heat/blob/master/heat/engine/hot/functions.py#L225
'heat_template_version' 支持的函数

            'Fn::GetAZs': cfn_funcs.GetAZs,
            'get_param': GetParam,
            'get_resource': cfn_funcs.ResourceRef,
            'Ref': cfn_funcs.Ref,
            'get_attr': GetAtt,
            'Fn::Select': cfn_funcs.Select,
            'Fn::Join': cfn_funcs.Join,
            'Fn::Split': cfn_funcs.Split,
            'str_replace': Replace,
            'Fn::Replace': cfn_funcs.Replace,
            'Fn::Base64': cfn_funcs.Base64,
            'Fn::MemberListToMap': cfn_funcs.MemberListToMap,
            'resource_facade': ResourceFacade,
            'Fn::ResourceFacade': cfn_funcs.ResourceFacade,
            'get_file': GetFile,

不同的部分用红色标注出来了。

不同头部section的区别:

AWSTemplateFormatVersion和HeatTemplateFormatVersion支持的字段
https://github.com/openstack/heat/blob/master/heat/engine/cfn/template.py#L22

'AWSTemplateFormatVersion',
'HeatTemplateFormatVersion',
'Description', 
'Mappings', 
'Parameters',
'Resources', 
'Outputs'

heat_template_version支持的字段:
https://github.com/openstack/heat/blob/master/heat/engine/hot/template.py#L24

'heat_template_version', 
'description', 
'parameter_groups',
'parameters', 
'resources',
'outputs',
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息