summaryrefslogtreecommitdiffstats
path: root/doctor_tests/maintenance_hot_tpl.yaml
blob: e2e47023110948a7cea7cdf10c4d914da5a75a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
heat_template_version: 2017-02-24
description: Doctor Maintenance test case

parameters:
  ext_net:
    type: string
    default: external
  flavor_vcpus:
    type: number
    default: 24
  maint_image:
    type: string
    default: cirros
  ha_intances:
    type: number
    default: 2
  nonha_intances:
    type: number
    default: 4
  app_manager_alarm_url:
    type: string
    default: http://0.0.0.0:12348/maintenance
  inpector_alarm_url:
    type: string
    default: http://0.0.0.0:12345/maintenance


resources:
  int_net:
    type: OS::Neutron::Net

  int_subnet:
    type: OS::Neutron::Subnet
    properties:
      network_id: {get_resource: int_net}
      cidr: "9.9.9.0/24"
      dns_nameservers: ["8.8.8.8"]
      ip_version: 4

  int_router:
    type: OS::Neutron::Router
    properties:
      external_gateway_info: {network: {get_param: ext_net}}

  int_interface:
    type: OS::Neutron::RouterInterface
    properties:
      router_id: {get_resource: int_router}
      subnet: {get_resource: int_subnet}

  maint_instance_flavor:
    type: OS::Nova::Flavor
    properties:
      name: doctor_maint_flavor
      ram: 512
      vcpus: {get_param: flavor_vcpus}
      disk: 1

  ha_app_svrgrp:
    type: OS::Nova::ServerGroup
    properties:
      name: doctor_ha_app_group
      policies: ['anti-affinity']

  floating_ip:
    type: OS::Nova::FloatingIP
    properties:
      pool: {get_param: ext_net}

  multi_ha_instances:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: ha_intances}
      resource_def:
        type: OS::Nova::Server
        properties:
          name: doctor_ha_app_%index%
          flavor: {get_resource: maint_instance_flavor}
          image: {get_param: maint_image}
          networks:
            - network: {get_resource: int_net}
          scheduler_hints:
            group: {get_resource: ha_app_svrgrp}

  multi_nonha_instances:
    type: OS::Heat::ResourceGroup
    properties:
      count: {get_param: nonha_intances}
      resource_def:
        type: OS::Nova::Server
        properties:
          name: doctor_nonha_app_%index%
          flavor: {get_resource: maint_instance_flavor}
          image: {get_param: maint_image}
          networks:
            - network: {get_resource: int_net}

  association:
    type: OS::Nova::FloatingIPAssociation
    properties:
      floating_ip: {get_resource: floating_ip}
      server_id: {get_attr: [multi_ha_instances, resource.0]}

  app_manager_alarm:
    type: OS::Aodh::EventAlarm
    properties:
      alarm_actions:
        - {get_param: app_manager_alarm_url}
      event_type: "maintenance.scheduled"
      repeat_actions: true

  inpector_alarm:
    type: OS::Aodh::EventAlarm
    properties:
      alarm_actions:
        - {get_param: inpector_alarm_url}
      event_type: "maintenance.host"
      repeat_actions: true