Skip to content

Commit df32ac2

Browse files
committed
Create the wildcard DNS entry for the dedicated LB
When using the dedicated load balancer, we're able to create the wildcard entries for the OpenShift pods. So this does just that.
1 parent f863d7f commit df32ac2

6 files changed

Lines changed: 35 additions & 2 deletions

File tree

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
@@ -238,6 +241,7 @@ resources:
238241
- config: {get_resource: set_extra_docker_repos}
239242
- config: {get_resource: host_update}
240243
- config: {get_resource: add_dns_record}
244+
- config: {get_resource: add_wildcard_record}
241245
- config: {get_resource: lb_boot}
242246

243247
# Compose the FQDN and set the hostname in the cloud-init data structure
@@ -345,6 +349,19 @@ resources:
345349
'%IP_ADDRESS%': {get_param: floatingip}
346350
template: {get_file: fragments/add_dns_record.sh}
347351

352+
add_wildcard_record:
353+
type: OS::Heat::SoftwareConfig
354+
properties:
355+
config:
356+
str_replace:
357+
params:
358+
'%DNS_ENTRY%': {list_join: ["", ["*.", {get_param: app_subdomain}]]}
359+
'%ZONE%': {get_param: domain_name}
360+
'%DNS_SERVER%': {get_param: [dns_servers, 0]}
361+
'%DNS_UPDATE_KEY%': {get_param: dns_update_key}
362+
'%IP_ADDRESS%': {get_param: floatingip}
363+
template: {get_file: fragments/add_dns_record.sh}
364+
348365

349366
# Prepare the host for SSH access for ansible
350367
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
@@ -979,6 +979,7 @@ resources:
979979
extra_rhn_pools: {get_param: extra_rhn_pools}
980980
hostname: {get_param: lb_hostname}
981981
domain_name: {get_param: domain_name}
982+
app_subdomain: {get_param: app_subdomain}
982983
stack_name: {get_param: 'OS::stack_name'}
983984
ansible_public_key: {get_attr: [ansible_keys, public_key]}
984985
fixed_subnet: {get_resource: fixed_subnet}

0 commit comments

Comments
 (0)