Heat: How to delete instance every 5 minutes ?

asked 2015-06-29 04:39:34 -0500

NgdOAB gravatar image

updated 2015-06-29 04:54:43 -0500

SGPJ gravatar image

For the realization of auto-scaling I made a template with heat and I've got e little problem. It works well but my heat template delete 1 instance after 5 minutes and not 1 instance every 5 minutes. How to do that ?

here is my tempalte.

heat_template_version: 2014-10-16
description: A simple auto scaling group.
resources:
  group:
    type: OS::Heat::AutoScalingGroup
    properties:
      desired_capacity: 1
      max_size: 5
      min_size: 1
      resource:
        type: OS::Nova::Server::Cirros

  scaleup_policy:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: { get_resource: group }
      cooldown: 60
      scaling_adjustment: 2

  scaledown_policy:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: { get_resource: group }
      cooldown: 60
      scaling_adjustment: -1

  cpu_alarm_high:
    type: OS::Ceilometer::Alarm
    properties:
      description: Scale-up if the average CPU > 50% for 1 minute
      meter_name: cpu_util
      statistic: avg
      period: 60
      evaluation_periods: 1
      threshold: 50
      alarm_actions:
        - {get_attr: [scaleup_policy, alarm_url]}
      comparison_operator: gt

  cpu_alarm_low:
    type: OS::Ceilometer::Alarm
    properties:
      description: Scale-down if the average CPU < 20% for 5 minutes
      meter_name: cpu_util
      statistic: avg
      period: 300
      evaluation_periods: 1
      threshold: 20
      alarm_actions:
        - {get_attr: [scaledown_policy, alarm_url]}
      comparison_operator: lt
edit retag flag offensive close merge delete

Comments

Could you please clarify your problem? The following is unclear.

"It works well but my heat template delete 1 instance after 5 minutes and not 1 instance every 5 minutes. How to do that ?"

Steve Baker gravatar imageSteve Baker ( 2015-07-05 17:45:47 -0500 )edit

Heat create 2 instances when the average CPU > 50% and if CPU stay above 50% my template still create instances. But when the average CPU < 20% heat delete only 1 instance after 5min and nothing more. Below 20% I'd like to delete 1 instance every 5 min not just 1. What's wrong on my template ?

NgdOAB gravatar imageNgdOAB ( 2015-07-06 02:50:22 -0500 )edit