aboutsummaryrefslogtreecommitdiff
path: root/dev/heat/kollanode.yaml
blob: a1fa11a6b0bf06d2d63a71b1fe94b96f125a4005 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
heat_template_version: 2013-05-23

description: >
  This is a nested stack that defines a single Kolla node,
  based on a Fedora 21 cloud image. This stack is included by
  a ResourceGroup resource in the parent template (kollacluster.yaml).

parameters:

  server_image:
    type: string
    default: fedora-21-x86_64
    description: glance image used to boot the server

  server_flavor:
    type: string
    default: m1.small
    description: flavor to use when booting the server

  ssh_key_name:
    type: string
    description: name of ssh key to be provisioned on our server

  external_network_id:
    type: string
    description: uuid of a network to use for kolla host floating ip addresses

  container_external_network_id:
    type: string
    description: uuid of a network to use for container floating ip addresses

  container_external_subnet_id:
    type: string
    description: uuid of a subnet to use for container floating ip addresses

  # The following are all generated in the parent template.
  fixed_network_id:
    type: string
    description: Network from which to allocate fixed addresses.
  fixed_subnet_id:
    type: string
    description: Subnet from which to allocate fixed addresses.

resources:

  node_wait_handle:
    type: "AWS::CloudFormation::WaitConditionHandle"

  node_wait_condition:
    type: "AWS::CloudFormation::WaitCondition"
    depends_on:
      - kolla_node
    properties:
      Handle:
        get_resource: node_wait_handle
      Timeout: "6000"

  ######################################################################
  #
  # Security groups.  We need to permit network traffic of various
  # sorts.
  #
  secgroup_base:
    type: "OS::Neutron::SecurityGroup"
    properties:
      rules:
        - protocol: icmp
        - protocol: tcp
          port_range_min: 22
          port_range_max: 22

  # Use by eth1 to permit all traffic to instances.
  # Let the Neutron container apply security to this traffic.
  secgroup_all_open:
    type: "OS::Neutron::SecurityGroup"
    properties:
      rules:
        - protocol: icmp
        - protocol: tcp
        - protocol: udp

  secgroup_kolla:
    type: "OS::Neutron::SecurityGroup"
    properties:
      rules:
        - protocol: tcp
          port_range_min: 5672
          port_range_max: 5672
        - protocol: tcp
          port_range_min: 3306
          port_range_max: 3306
        - protocol: tcp
          port_range_min: 8773
          port_range_max: 8776
        - protocol: tcp
          port_range_min: 6080
          port_range_max: 6080
        - protocol: tcp
          port_range_min: 6081
          port_range_max: 6081
        - protocol: tcp
          port_range_min: 35357
          port_range_max: 35357
        - protocol: tcp
          port_range_min: 5000
          port_range_max: 5000
        - protocol: tcp
          port_range_min: 9191
          port_range_max: 9191
        - protocol: tcp
          port_range_min: 9292
          port_range_max: 9292
        - protocol: tcp
          port_range_min: 9696
          port_range_max: 9696
        - protocol: tcp
          port_range_min: 80
          port_range_max: 80
        - protocol: tcp
          port_range_min: 443
          port_range_max: 443
        - protocol: tcp
          port_range_min: 8000
          port_range_max: 8000
        - protocol: tcp
          port_range_min: 8004
          port_range_max: 8004
        - protocol: tcp
          port_range_min: 8003
          port_range_max: 8003
        - protocol: tcp
          port_range_min: 8080
          port_range_max: 8080
        - protocol: tcp
          port_range_min: 8777
          port_range_max: 8777

  kolla_node:
    type: "OS::Nova::Server"
    properties:
      image:
        get_param: server_image
      flavor:
        get_param: server_flavor
      key_name:
        get_param: ssh_key_name
      user_data_format: RAW
      user_data:
        str_replace:
          template: |
            #!/bin/bash

            # Latest packages
            yum clean all
            yum -y update

            # Remove network manager
            yum -y remove NetworkManager
            chkconfig network on

            # Install base packages
            yum -y install wget ntp git tcpdump python-pip python-devel

            # Install Docker from binaries
            curl -L https://get.docker.com/builds/Linux/x86_64/docker-1.7.0 -o /usr/local/sbin/docker
            chmod +x /usr/local/sbin/docker && cd /usr/local/sbin/
            ./docker -d &

            # Install Compose with pid=host support
            cd /root
            git clone http://github.com/docker/compose.git
            cd compose
            pip install -e .

            # Pull the Kolla repo
            cd /root
            git clone https://git.openstack.org/openstack/kolla

            # Add vxlan kernel module for Neutron
            modprobe vxlan

            # Start NTP
            systemctl enable ntpd
            systemctl start ntpd

            # Install mariadb-client
            yum -y install mariadb

            # Install OpenStack Clients
            yum -y install python-keystoneclient python-glanceclient \
                           python-novaclient python-cinderclient \
                           python-neutronclient python-heatclient

            # Disable firewalld per OpenStack documentation
            service firewalld stop
            chkconfig firewalld off

            # Install Magnum Client
            git clone https://git.openstack.org/openstack/python-magnumclient
            cd python-magnumclient
            sudo pip install -e .

            # Send the CFN signal
            cfn-signal -e0 --data 'OK' -r 'Setup complete' '$WAIT_HANDLE'
          params:
            "$WAIT_HANDLE":
              get_resource: node_wait_handle
      networks:
        - port:
            get_resource: kolla_node_eth0
        - port:
            get_resource: kolla_node_eth1

  kolla_node_eth0:
    type: "OS::Neutron::Port"
    properties:
      network_id:
        get_param: fixed_network_id
      security_groups:
        - get_resource: secgroup_base
        - get_resource: secgroup_kolla
      fixed_ips:
        - subnet_id:
            get_param: fixed_subnet_id

  kolla_node_eth1:
    type: "OS::Neutron::Port"
    properties:
      network_id:
        get_param: container_external_network_id
      security_groups:
        - get_resource: secgroup_all_open
      fixed_ips:
        - subnet_id:
            get_param: container_external_subnet_id

  kolla_node_floating:
    type: "OS::Neutron::FloatingIP"
    properties:
      floating_network_id:
        get_param: external_network_id
      port_id:
        get_resource: kolla_node_eth0

outputs:

  kolla_node_ip_eth0:
    value: {get_attr: [kolla_node_eth0, fixed_ips, 0, ip_address]}

  kolla_node_external_ip:
    value: {get_attr: [kolla_node_floating, floating_ip_address]}