Skip to content

Commit

Permalink
Implement Designate resources in heat stack
Browse files Browse the repository at this point in the history
 * dns records created via FIP extension
 * dns records created via ports extension
 * dns records created statically

Related-Prod: PRODX-42483
Change-Id: I3611abef27401aceb7a3b2b5ba1d24517add5614
  • Loading branch information
jumpojoy committed May 22, 2024
1 parent 20cf804 commit 7b1ed0d
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 1 deletion.
20 changes: 20 additions & 0 deletions heat-templates/fragments/AppInstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ parameters:
type: string
description: Protocol for App loadbalancer
default: HTTP
app_dns_zone_id:
type: string
app_dns_zone_name:
type: string

conditions:
deploy_additional_app_listener:
Expand Down Expand Up @@ -301,25 +305,33 @@ resources:
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: private_server_01_port }
dns_name: app01
dns_domain: { get_param: app_dns_zone_name }

server_02_floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: private_server_02_port }
dns_name: app02
dns_domain: { get_param: app_dns_zone_name }

server_03_floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: private_server_03_port }
dns_name: app03
dns_domain: { get_param: app_dns_zone_name }

server_04_floating_ip:
type: OS::Neutron::FloatingIP
condition: deploy_additional_app_listener
properties:
floating_network_id: { get_param: public_network_id }
port_id: { get_resource: private_server_04_port }
dns_name: app04
dns_domain: { get_param: app_dns_zone_name }

wait_handle:
type: OS::Heat::WaitConditionHandle
Expand Down Expand Up @@ -403,6 +415,14 @@ resources:
floating_network_id: {get_param: public_network_id}
port_id: {get_attr: [lb, vip_port_id]}

app_vip_redcordset:
type: OS::Designate::RecordSet
properties:
name: app-vip
records: [ { get_attr: [ lb_floating, floating_ip_address ] } ]
type: A
zone: { get_param: app_dns_zone_id }

outputs:
app_private_ips:
description: Private IP addresses of app nodes
Expand Down
4 changes: 3 additions & 1 deletion heat-templates/fragments/DatabaseInstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ resources:
properties:
network_id: { get_param: database_network_id }
port_security_enabled: false
dns_name: db01
fixed_ips:
- subnet: { get_param: database_subnet_id }

Expand All @@ -208,6 +209,7 @@ resources:
properties:
network_id: { get_param: database_network_id }
port_security_enabled: false
dns_name: db02
fixed_ips:
- subnet: { get_param: database_subnet_id }

Expand All @@ -216,6 +218,7 @@ resources:
properties:
network_id: { get_param: database_network_id }
port_security_enabled: false
dns_name: db03
fixed_ips:
- subnet: { get_param: database_subnet_id }

Expand Down Expand Up @@ -350,7 +353,6 @@ resources:
protocol_port: 3306
subnet: { get_param: database_subnet_id }


outputs:
database_private_ips:
description: Private IP addresses of database nodes
Expand Down
52 changes: 52 additions & 0 deletions heat-templates/fragments/Network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,35 @@ parameters:
default: 'public'
dns_nameservers:
type: json
dns_zone:
type: string

resources:

dns_random_string:
type: OS::Heat::RandomString
properties:
character_classes: [{"class": lowercase, "min": 10}]
length: 10

database_zone_name:
type: OS::Heat::Value
properties:
value:
list_join: [ '.', [ { get_resource: dns_random_string }, 'db', { get_param: dns_zone } ]]
type: string

database_zone:
type: OS::Designate::Zone
properties:
name: { get_attr: [database_zone_name, value] }
description: String
email: [email protected]

database_network:
type: OS::Neutron::Net
properties:
dns_domain: { get_attr: [database_zone_name, value] }
database_subnet:
type: OS::Neutron::Subnet
properties:
Expand All @@ -24,8 +48,24 @@ resources:
cidr: { get_param: database_network_cidr }
dns_nameservers: { get_param: dns_nameservers }

app_zone_name:
type: OS::Heat::Value
properties:
value:
list_join: [ '.', [ { get_resource: dns_random_string }, 'app', { get_param: dns_zone } ]]
type: string

app_zone:
type: OS::Designate::Zone
properties:
name: { get_attr: [app_zone_name, value] }
description: String
email: [email protected]

app_network:
type: OS::Neutron::Net
properties:
dns_domain: { get_attr: [app_zone_name, value] }
app_subnet:
type: OS::Neutron::Subnet
properties:
Expand Down Expand Up @@ -59,9 +99,21 @@ outputs:
database_subnet_id:
description: The uuid of database subnet
value: { get_resource: database_subnet }
database_dns_zone_id:
description: The uuid of refapp DB DNS zone
value: { get_resource: database_zone }
database_dns_zone_name:
description: The name for DNS zone with database refapp
value: { get_attr: [database_zone_name, value] }
app_network_id:
description: The uuid of app network
value: { get_resource: app_network }
app_subnet_id:
description: The uuid of app subnet
value: { get_resource: app_subnet }
app_dns_zone_id:
description: The uuid of refapp APP DNS zone
value: { get_resource: app_zone }
app_dns_zone_name:
description: The name for DNS zone with APPs refapp
value: { get_attr: [app_zone_name, value] }
13 changes: 13 additions & 0 deletions heat-templates/top.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ parameters:
type: string
description: Algorithm for Database loadbalancer
default: SOURCE_IP
dns_zone:
type: string
default: 'refapp.test.'

resources:
key_pair:
type: OS::Nova::KeyPair
Expand All @@ -79,6 +83,7 @@ resources:
app_network_cidr: { get_param: app_network_cidr }
public_network_id: { get_param: public_network_id }
dns_nameservers: { get_param: dns_nameservers }
dns_zone: { get_param: dns_zone }

database:
type: ./fragments/DatabaseInstances.yaml
Expand Down Expand Up @@ -116,6 +121,8 @@ resources:
app_lb_algorithm: { get_param: app_lb_algorithm }
app_lb_protocol: { get_param: app_lb_protocol }
app_database_password: { get_param: app_database_password }
app_dns_zone_id: { get_attr: [network, app_dns_zone_id ] }
app_dns_zone_name: { get_attr: [network, app_dns_zone_name ] }

outputs:
database_private_ips:
Expand All @@ -133,6 +140,12 @@ outputs:
database_floating_ips:
description: Database instances floating IPs
value: { get_attr: [database, database_floating_ips] }
database_dns_zone_name:
description: The name for DNS zone with database refapp
value: { get_attr: [database, app_dns_zone_name] }
app_dns_zone_name:
description: The name for DNS zone with APPs refapp
value: { get_attr: [app, database_dns_zone_name] }
app_url:
description: API url for the reference application
value:
Expand Down

0 comments on commit 7b1ed0d

Please sign in to comment.