Skip to content

Commit ff7e24d

Browse files
committed
Introduce a new node net resource template: NodeNet1WithPreallocatedFIP
This is for cases where we must use existing pre-allocated floating IPs.
1 parent b72cc06 commit ff7e24d

File tree

8 files changed

+110
-0
lines changed

8 files changed

+110
-0
lines changed

files/environments/nodenet-library.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
resource_registry:
33
Cluster::NodeNet1: ../resources/nodenet-1.yaml
44
Cluster::NodeNet1WithFIP: ../resources/nodenet-w-fip.yaml
5+
Cluster::NodeNet1WithPreallocatedFIP: ../resources/nodenet-w-prealloc-fip.yaml
56
Cluster::NodeNet2: ../resources/nodenet-2.yaml
67
Cluster::NodeNet3: ../resources/nodenet-3.yaml

files/resources/cluster-group.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ conditions:
6969
expression: $.data.cluster_group.containsKey('nodenet_resource')
7070
data:
7171
cluster_group: { get_param: [cluster_groups, {get_param: group_idx}] }
72+
nodenet_fips_set:
73+
yaql:
74+
expression: $.data.cluster_group.containsKey('nodenet_fips')
75+
data:
76+
cluster_group: { get_param: [cluster_groups, {get_param: group_idx}] }
7277

7378
resources:
7479
port_group:
@@ -83,6 +88,12 @@ resources:
8388
- { get_param: cluster_nodenet_resource }
8489
properties:
8590
cluster_net: { get_param: cluster_net }
91+
cluster_fips:
92+
if:
93+
- nodenet_fips_set
94+
- { get_param: [cluster_groups, {get_param: group_idx}, nodenet_fips ] }
95+
- []
96+
node_idx: "%index%"
8697

8798
node_group:
8899
type: OS::Heat::ResourceGroup

files/resources/nodenet-1.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ description: >
66
a named network and subnet (and does not have a floating IP)
77
88
parameters:
9+
node_idx:
10+
type: number
11+
label: Node index within cluster group
912
cluster_net:
1013
type: json
1114
label: Network names and subnets to which the nodes should be attached
15+
cluster_fips:
16+
type: json
17+
label: List of UUIDs of prealloacted floating IPs
18+
default: []
1219

1320
conditions:
1421
security_groups_set:

files/resources/nodenet-2-w-fip.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ description: >
66
a named network and subnet. A floating IP is created for the port.
77
88
parameters:
9+
node_idx:
10+
type: number
11+
label: Node index within cluster group
912
cluster_net:
1013
type: json
1114
label: Network names and subnets to which the nodes should be attached
15+
cluster_fips:
16+
type: json
17+
label: List of UUIDs of prealloacted floating IPs
18+
default: []
1219

1320
conditions:
1421
security_groups_set:

files/resources/nodenet-2.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ description: >
99
the node.
1010
1111
parameters:
12+
node_idx:
13+
type: number
14+
label: Node index within cluster group
1215
cluster_net:
1316
type: json
1417
label: Network names and subnets to which the nodes should be attached
18+
cluster_fips:
19+
type: json
20+
label: List of UUIDs of prealloacted floating IPs
21+
default: []
1522

1623
conditions:
1724
security_groups_set:

files/resources/nodenet-3.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ description: >
99
the node.
1010
1111
parameters:
12+
node_idx:
13+
type: number
14+
label: Node index within cluster group
1215
cluster_net:
1316
type: json
1417
label: Network names and subnets to which the nodes should be attached
18+
cluster_fips:
19+
type: json
20+
label: List of UUIDs of prealloacted floating IPs
21+
default: []
1522

1623
conditions:
1724
security_groups_set:

files/resources/nodenet-w-fip.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ description: >
66
a named network and subnet. A floating IP is created for the port.
77
88
parameters:
9+
node_idx:
10+
type: number
11+
label: Node index within cluster group
912
cluster_net:
1013
type: json
1114
label: Network names and subnets to which the nodes should be attached
15+
cluster_fips:
16+
type: json
17+
label: List of UUIDs of prealloacted floating IPs
18+
default: []
1219

1320
conditions:
1421
security_groups_set:
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
heat_template_version: pike
3+
4+
description: >
5+
Heat stack template for a stack containing one Neutron port which is on
6+
a named network and subnet. A floating IP is created for the port.
7+
8+
parameters:
9+
node_idx:
10+
type: number
11+
label: Node index within cluster group
12+
cluster_fips:
13+
type: json
14+
label: List of UUIDs of prealloacted floating IPs
15+
default: []
16+
cluster_net:
17+
type: json
18+
label: Network names and subnets to which the nodes should be attached
19+
20+
conditions:
21+
security_groups_set:
22+
yaql:
23+
expression: $.data.cluster_net.containsKey('security_groups')
24+
data:
25+
cluster_net: { get_param: [ cluster_net, 0 ] }
26+
27+
resources:
28+
port:
29+
type: OS::Neutron::Port
30+
properties:
31+
network: { get_param: [ cluster_net, 0, net ] }
32+
security_groups:
33+
if:
34+
- security_groups_set
35+
- { get_param: [ cluster_net, 0, security_groups ] }
36+
- []
37+
fixed_ips:
38+
- subnet_id: { get_param: [ cluster_net, 0, subnet ] }
39+
40+
floating_ip_association:
41+
type: OS::Neutron::FloatingIPAssociation
42+
properties:
43+
floatingip_id: { get_param: [ cluster_fips, {get_param: node_idx}, uuid ] }
44+
port_id: { get_resource: port }
45+
46+
outputs:
47+
OS::stack_id:
48+
description: The network list
49+
value:
50+
- port: { get_resource: port }
51+
52+
networks:
53+
description: The network list
54+
value:
55+
- port: { get_resource: port }
56+
57+
internal_ip:
58+
description: ID of the IP assigned on the named cluster network
59+
value: { get_attr: [ port, fixed_ips, 0, ip_address ] }
60+
61+
primary_ip:
62+
description: ID of the Neutron floating IP
63+
value: { get_param: [ cluster_fips, {get_param: node_idx}, ip ] }

0 commit comments

Comments
 (0)