Skip to content

Commit 651082b

Browse files
authored
Merge pull request #331 from redhat-openstack/apps-dedicated-lb
Create the wildcard DNS entry for the dedicated LB
2 parents a17b02b + 15b6c5a commit 651082b

7 files changed

Lines changed: 38 additions & 3 deletions

README.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,9 @@ you can pass the update key in the `dns_update_key` parameter and each
563563
node will register its internal IP address to all the DNS servers in
564564
the `dns_nameserver` list.
565565

566-
You will still need to set the API and wildcard entries, though.
566+
In addition, if you use the *dedicated load balancer*, the API and
567+
wildcard entries will be created as well. Otherwise, you will need to
568+
set them manually.
567569

568570

569571
== Retrieving the OpenShift CA certificate

fragments/add_dns_record.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ else
1818
retry yum -y install python2-dns
1919
fi
2020

21-
HOSTNAME="$(hostname --fqdn)"
21+
22+
NAME="%DNS_ENTRY%"
23+
24+
# If we didn't get an explicit name, use this server's hostname
25+
if [ -n "$NAME" -a "${NAME:0:1}" = "%" -a "${NAME: -1}" = "%" ]; then
26+
NAME="$(hostname)"
27+
fi
2228

2329
# NOTE: the dot after the hostname is necessary
24-
/usr/local/bin/update_dns -z "%ZONE%" -s "%DNS_SERVER%" -k "$DNS_UPDATE_KEY" "$HOSTNAME." "%IP_ADDRESS%"
30+
/usr/local/bin/update_dns -z "%ZONE%" -s "%DNS_SERVER%" -k "$DNS_UPDATE_KEY" "$NAME." "%IP_ADDRESS%"

loadbalancer_dedicated.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ parameters:
4646
All VMs will be placed in this domain
4747
type: string
4848

49+
app_subdomain:
50+
type: string
51+
4952
rhn_username:
5053
description: >
5154
A valid user with entitlements to RHEL and OpenShift software repos
@@ -243,6 +246,7 @@ resources:
243246
- config: {get_resource: set_extra_docker_repos}
244247
- config: {get_resource: host_update}
245248
- config: {get_resource: add_dns_record}
249+
- config: {get_resource: add_wildcard_record}
246250
- config: {get_resource: lb_boot}
247251

248252
# Compose the FQDN and set the hostname in the cloud-init data structure
@@ -363,6 +367,19 @@ resources:
363367
'%IP_ADDRESS%': {get_param: floatingip}
364368
template: {get_file: fragments/add_dns_record.sh}
365369

370+
add_wildcard_record:
371+
type: OS::Heat::SoftwareConfig
372+
properties:
373+
config:
374+
str_replace:
375+
params:
376+
'%DNS_ENTRY%': {list_join: ["", ["*.", {get_param: app_subdomain}]]}
377+
'%ZONE%': {get_param: domain_name}
378+
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
379+
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
380+
'%IP_ADDRESS%': {get_param: floatingip}
381+
template: {get_file: fragments/add_dns_record.sh}
382+
366383

367384
# Prepare the host for SSH access for ansible
368385
lb_boot:

loadbalancer_external.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ parameters:
4848
All VMs will be placed in this domain
4949
type: string
5050

51+
app_subdomain:
52+
type: string
53+
5154
rhn_username:
5255
description: >
5356
A valid user with entitlements to RHEL and OpenShift software repos

loadbalancer_neutron.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ parameters:
4747
All VMs will be placed in this domain
4848
type: string
4949

50+
app_subdomain:
51+
type: string
52+
5053
rhn_username:
5154
description: >
5255
A valid user with entitlements to RHEL and OpenShift software repos

loadbalancer_none.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ parameters:
4444
All VMs will be placed in this domain
4545
type: string
4646

47+
app_subdomain:
48+
type: string
49+
4750
rhn_username:
4851
description: >
4952
A valid user with entitlements to RHEL and OpenShift software repos

openshift.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ resources:
988988
extra_rhn_pools: {get_param: extra_rhn_pools}
989989
hostname: {get_param: lb_hostname}
990990
domain_name: {get_param: domain_name}
991+
app_subdomain: {get_param: app_subdomain}
991992
stack_name: {get_param: 'OS::stack_name'}
992993
ansible_public_key: {get_attr: [ansible_keys, public_key]}
993994
fixed_subnet: {get_resource: fixed_subnet}

0 commit comments

Comments
 (0)