Heat Orchestration Template (HOT) specification

1.   Template structure

1.1   status

HOT是一个新的模板格式,取代了Heat CloudFormation-compatible format(CFN),自Juno版本后,Heat开始支持HOT的多个版本

1.2   Template格式

HOT模板样式由YAML定义,形式如下:

heat_template_version: 2015-04-30

description:

# a description of the template

parameter_groups:

# a declaration of input parameter groups and order

parameters:

# declaration of input parameters

resources:

# declaration of template resources

outputs:

# declaration of output parameters

  1. heat_template_version
  1. description

可选关键字,模板描述

  1. parameter_groups

可选关键字,给输入参数分组并提供参数次序

  1. parameters

可选关键字,指定初始化模板时的输入参数

  1. resources

定义模板中的资源,本模块至少要定义一个资源,否则初始化模板无效

  1. outputs

可选关键字,指定模板初始化结束后用户可得到的输出参数

1.2.1            Heat template version

参数说明了该YAML文件是HOT模板的一个特定版本,也指出了模板验证和支持的功能。目前Heat支持以下Heat template version关键字,他们分别支持的功能为:

2013-05-23


get_attr


get_file


get_param


get_resource


list_join


resource_facade


str_replace


Fn::Base64


Fn::GetAZs


Fn::Join


Fn::MemberListToMap


Fn::Replace


Fn::ResourceFacade


Fn::Select


Fn::Split


Ref

2014-10-16


get_attr


get_file


get_param


get_resource


list_join


resource_facade


str_replace


Fn::Select

2015-04-30


get_attr


get_file


get_param


get_resource


list_join


resource_facade


str_replace


repeat


Fn::Select

2015-10-15


get_attr


get_file


get_param


get_resource


list_join


resource_facade


str_replace


repeat


Fn::Select


digest


str_split

1.2.2            Parameter groups section

模块格式为:

parameter_groups:

- label: <human-readable label of parameter group>

description: <description of the parameter group>

parameters:

- <param name>

- <param name>

label:参数组标签

description:参数组描述

parameters:参数列表

param name:参数名字,与parameters模块中定义的参数关联

1.2.3            Parameters section

模块格式为:

parameters:

<param name>:

type: <string | number | json | comma_delimited_list | boolean>

label: <human-readable name of the parameter>

description: <description of the parameter>

default: <default value for parameter>

hidden: <true | false>

constraints:

<parameter constraints>

param name:参数名字

type:参数类型


Type


Description


Examples


string


A literal string.


“String param”


number


An integer or float.


“2”; “0.2”


comma_delimited_list


An array of literal strings that are separated by commas. The total number of strings should be one more than the total number of commas.


[“one”, “two”]; “one, two”; Note: “one, two” returns [“one”, ” two”]


json


A JSON-formatted map or list.


{“key”: “value”}


boolean


Boolean type value, which can be equal “t”, “true”, “on”, “y”, “yes”, or “1” for true value and “f”, “false”, “off”, “n”, “no”, or “0” for false value.


“on”; “n

label:可选关键字,参数标签

description:可选关键字,参数描述

default:可选关键字,参数默认值

hidden:当用请求查看该模板创建的stack信息时,该参数是否需要隐藏,默认false

constraints:可选关键字,约束列表,用户部署stack时由Orchestration engine验证

约束模块格式为:

constraints:

- <constraint type>: <constraint definition>

description: <constraint description>

description:可选关键字,约束描述

constrains type:约束类型

constraint definition:约束内容,与类型对应关系如下


约束类型


约束对象


约束内容


length


string

length: { min: <lower limit>, max: <upper limit> }


range


number

range: { min: <lower limit>, max: <upper limit> }


allowed_values


string or number

allowed_values: [ <value>, <value>, ... ]


allowed_pattern


string

allowed_pattern: <regular expression>


custom_constraint


检查特定资源是否存在

资源列表如下

custom_constraint: <name>


Pseudo parameters


stack


OS::stack_name

OS::stack_id

OS::project_id

The following section lists the custom constraints and the plug-ins that support them.


Name


Plug-in


cinder.backup


heat.engine.clients.os.cinder:VolumeBackupConstraint


cinder.snapshot


heat.engine.clients.os.cinder:VolumeSnapshotConstraint


cinder.volume


heat.engine.clients.os.cinder:VolumeConstraint


cinder.vtype


heat.engine.clients.os.cinder:VolumeTypeConstraint


cron_expression


heat.engine.constraint.common_constraints:CRONExpressionConstraint


designate.domain


heat.engine.clients.os.designate:DesignateDomainConstraint


glance.image


heat.engine.clients.os.glance:ImageConstraint


ip_addr


heat.engine.constraint.common_constraints:IPConstraint


iso_8601


heat.engine.constraint.common_constraints:ISO8601Constraint


keystone.domain


heat.engine.clients.os.keystone:KeystoneDomainConstraint


keystone.group


heat.engine.clients.os.keystone:KeystoneGroupConstraint


keystone.project


heat.engine.clients.os.keystone:KeystoneProjectConstraint


keystone.role


heat.engine.clients.os.keystone:KeystoneRoleConstraint


keystone.service


heat.engine.clients.os.keystone:KeystoneServiceConstraint


keystone.user


heat.engine.clients.os.keystone:KeystoneUserConstraint


mac_addr


heat.engine.constraint.common_constraints:MACConstraint


manila.share_network


heat.engine.clients.os.manila:ManilaShareNetworkConstraint


manila.share_snapshot


heat.engine.clients.os.manila:ManilaShareSnapshotConstraint


manila.share_type


heat.engine.clients.os.manila:ManilaShareTypeConstraint


monasca.notification


heat.engine.clients.os.monasca:MonascaNotificationConstraint


net_cidr


heat.engine.constraint.common_constraints:CIDRConstraint


neutron.network


heat.engine.clients.os.neutron:NetworkConstraint


neutron.port


heat.engine.clients.os.neutron:PortConstraint


neutron.router


heat.engine.clients.os.neutron:RouterConstraint


neutron.subnet


heat.engine.clients.os.neutron:SubnetConstraint


nova.flavor


heat.engine.clients.os.nova:FlavorConstraint


nova.keypair


heat.engine.clients.os.nova:KeypairConstraint


nova.network


heat.engine.clients.os.nova:NetworkConstraint


nova.server


heat.engine.clients.os.nova:ServerConstraint


sahara.image


heat.engine.clients.os.sahara:ImageConstraint


sahara.plugin


heat.engine.clients.os.sahara:PluginConstraint


timezone


heat.engine.constraint.common_constraints:TimezoneConstraint


trove.flavor


heat.engine.clients.os.trove:FlavorConstraint

1.2.4            Resources section

模块格式:

resources:

<resource ID>:

type: <resource type>

properties:

<property name>: <property value>

metadata:

<resource specific metadata>

depends_on: <resource ID or list of ID>

update_policy: <update policy>

deletion_policy: <deletion policy>

resource ID:在该template内唯一

type:资源类型,例如OS::Nova::Server or OS::Neutron::Port

properties:可选关键字,资源特性列表,属性值可以直接提供,或通过一个函数(内部函数见后文)

metadata:可选关键字,元数据

depends_on:可选关键字,资源依赖关系

应用举例:一个资源依赖于一个或更多资源时,

resources:

server1:

type: OS::Nova::Server

depends_on: [ server2, server3 ]

server2:

type: OS::Nova::Server

server3:

type: OS::Nova::Server

update_policy:可选关键字,资源更新策略,是否支持更新策略以及确切的语义取决于资源类型

deletion_policy:可选关键字,可选关键字,资源删除策略,支持的删除策略类型取决于资源类型

1.2.5            Outputs section

模块格式:

outputs:

<parameter name>:

description: <description>

value: <parameter value>

parameter name:输出参数名字,template内唯一

description:可选参数,输出参数描述

parameter value:输出参数值,通常由函数得到(内部函数见后文)

2.   内部函数

Note:这些函数值能用于resource的properties模块,或output模块

2.1   get_attr:引用资源属性

基于关键字或索引的方法需要heat_template_version 2014-10-16或更高

2015-10-15以后,<attribute_name>为可选关键字,缺省为all attributes

get_attr:

- <resource name>

- <attribute name>

- <key/index 1> (optional)

- <key/index 2> (optional)

- ...

2.2   get_file:返回template中file的内容

实参必须是一个静态路径或URL,且不能依赖于内部函数

get_file: <content key>d

2.3   get_param:引用模板的输入参数

get_param:

- <parameter name>

- <key/index 1> (optional)

- <key/index 2> (optional)

- ...

2.4   get_resource:引用同一模板中的其他resource

get_resource: <resource ID>

2.5   list_join:把给定分隔符加入strings列表

list_join:

- <delimiter>

- <list to join>

2.6   str_split:list_join的相反操作

str_split:

- ‘,‘

- string,to,split

2.7   digest:对给定值进行digest操作

Kilo版本引进,2015-04-30之后版本可用

算法由hashlib提供(md5, sha1, sha224, sha256, sha384, and sha512),或OpenSSL

digest:

- <algorithm>

- <value>

2.8   repeat:动态改变模板资源列表中的内容,返回一个新的列表

list内容可以来自一个函数

repeat:

template:

<template>

for_each:

<var>: <list>

2.9   resource_facade:在父模板中提取数据

resource_facade: <data type>

2.10 str_replace:用给定值替换template中的相应内容

str_replace:

template: <template string>

params: <parameter mappings>

时间: 2024-08-27 16:39:12

Heat Orchestration Template (HOT) specification的相关文章

openStack Use Orchestration module(heat) create and manage cloud resources

The Orchestration module(heat) uses a heat orchestration template(HOT)to create and manage cloud resources; The Orchestration module provides a template-based orchestration for description a cloud application,generrate running cloud applications; the

【译】OpenStack Heat基础介绍

原文:http://blog.scottlowe.org/2014/05/01/an-introduction-to-openstack-heat/ 本文将简要地介绍OpenStack Heat. Heat项目提供协作服务,允许我们可以自动地创建多个计算实例,逻辑网络,以及对其他的云服务的操作.请注意,这只是一个简要介绍—我不是Heat的专家,我只是想要分享一些基本信息以便读者可以更快的使用Heat. 为了在以下的具体的例子中不至于产生困扰,我们先从术语开始. Stack(栈): 在Heat领域

Openstack Mitika组件介绍

OpenStack覆盖了网络.虚拟化.操作系统.服务器等各个方面.它是一个正在开发中的云计算平台项目,根据成熟及重要程度的不同,被分解成核心项目.孵化项目,以及支持项目和相关项目.每个项目都有自己的委员会和项目技术主管,而且每个项目都不是一成不变的,孵化项目可以根据发展的成熟度和重要性,转变为核心项目.最新版本Mitaka共16个核心项目(即OpenStack服务).                               Openstack体系结构图(仅包括了几个重要的组件) 1.1计算服

centos7部署openstack-ocata

1.前言 本文旨在记录本人的一个实验过程,因为其中有一些坑,方便以后回顾查询. 其中限于篇幅(大部分是配置部分)有些内容省略掉了,官网都有,各位如果是安装部署的话可以参考官网,不建议使用本文. 以下是ocata版本官网链接 https://docs.openstack.org/ocata/zh_CN/install-guide-rdo/common/conventions.html 2.环境 在centOS 7中部署Openstack,按照官网只需要控制节点和计算节点,网络节点安装和控制节点安装

[OpenStack]Deploy WordPress Using Heat

This is the HOT for WordPess deployment on top of OpenStack environment. heat_template_version: 2014-09-06 description: > Heat Docker template using software deployments. parameters: key_name: type: string description : Name of a KeyPair to enable SS

七、OpenStack入门 之 若干讨论

几个讨论题 仅供参考,如有雷同,纯属呵(qiao)呵(he) 1. 讨论:如何回馈 OpenStack 社区 张三: 积极关注并回馈社区,贡献代码,争取成为 committer: 积极将研发使用中遇到的问题及代码 ,回馈到社区: 将 issue.idea.丰富的 feature 提交到 bluePrint,提交到社区: 利用自己的一切资源致力于扩大中国 IT 力量在国际的影响力!(评:看到这句好欣慰!我想如果有更多这样的同学在,中国的 IT 前途很有希望): 李四: 关注各种社区并加入到符合自己

通过devstack自动部署Openstack icehouse 版本

问题导读1.脚本自动化部署原理是什么?2.重启虚拟机后,登录 Dashboard 时出现错误,如何解决?3.stack.sh 执行之 pip-1.4.1 安装失败,怎么办? 本篇主要阐述通过DeveStack 去部署Openstack(icehouse),对大多数来说安装部署Openstack 来说是个痛苦的过程,尤其是 OpenStack和它依赖的一些组件在快速发展中,经常出现这个版本组件对不上那个版本 dashboard  等 情况.如果只是 看看或者初期玩玩 OpenStack的话,使用

ubuntu 14.04安装 DevStack的脚本配置文件——localrc

本文ubuntu 14.04安装 DevStack的脚本配置文件——localrc,本文件名已经逐渐被取代,但是出于后向兼容性,使用该文件仍然可以为stack.sh安装脚本指定安装DevStack时的配置信息. 以下是localrc文件的一些常用配置及解释 # Misc DATABASE_PASSWORD=123456 ADMIN_PASSWORD=123456 SERVICE_PASSWORD=123456 SERVICE_TOKEN=123456 RABBIT_PASSWORD=123456

OpenStack 搭建(一)

OpenStack介绍 openstack是一个云平台管理项目,我们可以使用openstack来管理我们的资源池,在这个资源池中包含了很多的子项目.openstack是有多个不同的模块组成,不同的功能有相对应得不同模块负责.openstack三大核心分别是 计算.网络.存储.通过调用不同模块的API来对外提供交互. openstack 的版本发布很快,从最初的A版到现在的N版,官方一般会每隔六个月发布一个新的版本. openstack每个服务都有对应的项目名称,不同的项目就相当于一个提供单独服务