heat-templates/hot/senlin/cluster.yaml

96 lines
2.3 KiB
YAML

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]}