Add example templates for senlin resources

This patch adds an example templates for senlin resources, it
shows the capability of senlin clustering services.

Change-Id: I8ea707cdbf33039d394061bf6018e85e0217294f
This commit is contained in:
Ethan Lynn 2016-03-07 13:22:28 +08:00
parent 96a0b0b3d2
commit 2d77c029a3
1 changed files with 96 additions and 0 deletions

96
hot/senlin/cluster.yaml Normal file
View File

@ -0,0 +1,96 @@
heat_template_version: 2016-04-08
description: >
This template demostrate how to use senlin resources to create
a flexible cluster.
parameters:
flavor:
description: Flavor for the instances to be created.
type: string
default: m1.nano
image:
description: Name or ID of the image to use for the instances.
type: string
default: cirros-0.3.4-x86_64-uec
key_name:
description: Name of an existing key pair to use for the instances.
type: string
network:
description: The network for the instances.
type: string
default: private
resources:
profile:
type: OS::Senlin::Profile
properties:
type: os.nova.server-1.0
properties:
flavor: {get_param: flavor}
image: {get_param: image}
key_name: {get_param: key_name}
networks:
- network: {get_param: network}
cluster:
type: OS::Senlin::Cluster
properties:
desired_capacity: 1
profile: {get_resource: profile}
scale_in_policy:
type: OS::Senlin::Policy
properties:
type: senlin.policy.scaling-1.0
bindings:
- cluster: {get_resource: cluster}
properties:
event: CLUSTER_SCALE_IN
adjustment:
type: CHANGE_IN_CAPACITY
number: 1
scale_out_policy:
type: OS::Senlin::Policy
properties:
type: senlin.policy.scaling-1.0
bindings:
- cluster: {get_resource: cluster}
properties:
event: CLUSTER_SCALE_OUT
adjustment:
type: CHANGE_IN_CAPACITY
number: 1
receiver_scale_out:
type: OS::Senlin::Receiver
properties:
cluster: {get_resource: cluster}
action: CLUSTER_SCALE_OUT
type: webhook
receiver_scale_in:
type: OS::Senlin::Receiver
properties:
cluster: {get_resource: cluster}
action: CLUSTER_SCALE_IN
type: webhook
outputs:
webhook_scale_out:
description: Webhook to scale out cluster.
value:
str_replace:
template: curl -X POST LINK
params:
LINK: {get_attr: [receiver_scale_out, channel, alarm_url]}
webhook_scale_in:
description: Webhook to scale in cluster.
value:
str_replace:
template: curl -X POST LINK
params:
LINK: {get_attr: [receiver_scale_in, channel, alarm_url]}