d4b943b4ff
Change-Id: I3d806358ba1a557d8b2765a808a0e6585f4fe74c
76 lines
2.0 KiB
YAML
76 lines
2.0 KiB
YAML
heat_template_version: 2013-05-23
|
|
|
|
parameters:
|
|
KeyName:
|
|
type: string
|
|
InstanceType:
|
|
type: string
|
|
ImageId:
|
|
type: string
|
|
SecurityGroup:
|
|
type: string
|
|
Net:
|
|
type: string
|
|
|
|
resources:
|
|
my_asg:
|
|
type: OS::Heat::AutoScalingGroup
|
|
properties:
|
|
resource:
|
|
type: OS::Nova::Server
|
|
properties:
|
|
metadata: {"metering.stack": {get_param: "OS::stack_id"}}
|
|
key_name: { get_param: KeyName }
|
|
image: { get_param: ImageId }
|
|
flavor: { get_param: InstanceType }
|
|
security_groups:
|
|
- get_param: SecurityGroup
|
|
networks:
|
|
- network: {get_param: Net}
|
|
min_size: 1
|
|
max_size: 3
|
|
|
|
scale_up_policy:
|
|
type: OS::Heat::ScalingPolicy
|
|
properties:
|
|
adjustment_type: change_in_capacity
|
|
auto_scaling_group_id: {get_resource: my_asg}
|
|
cooldown: 60
|
|
scaling_adjustment: 2
|
|
|
|
scale_down_policy:
|
|
type: OS::Heat::ScalingPolicy
|
|
properties:
|
|
adjustment_type: change_in_capacity
|
|
auto_scaling_group_id: {get_resource: my_asg}
|
|
cooldown: 60
|
|
scaling_adjustment: '-1'
|
|
|
|
cpu_alarm_high:
|
|
type: OS::Ceilometer::Alarm
|
|
properties:
|
|
description: Scale-up if count of instance <= 1 for 1 minute
|
|
meter_name: network.incoming.bytes
|
|
statistic: count
|
|
period: 60
|
|
evaluation_periods: 1
|
|
threshold: 1
|
|
alarm_actions:
|
|
- {get_attr: [scale_up_policy, alarm_url]}
|
|
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
|
|
comparison_operator: le
|
|
|
|
cpu_alarm_low:
|
|
type: OS::Ceilometer::Alarm
|
|
properties:
|
|
description: Scale-down if maximum count of instance > 2 for 1 minutes
|
|
meter_name: network.incoming.bytes
|
|
statistic: count
|
|
period: 60
|
|
evaluation_periods: 1
|
|
threshold: 2
|
|
alarm_actions:
|
|
- {get_attr: [scale_down_policy, alarm_url]}
|
|
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
|
|
comparison_operator: gt
|