Skip to content

Commit 2afbdf5

Browse files
Merge pull request #1295 from beagles/enable-designate
Complete role and docs for enabling designate
2 parents 1dc5e8d + fb1fc22 commit 2afbdf5

5 files changed

Lines changed: 293 additions & 1 deletion

File tree

docs_user/modules/proc_adopting-the-dns-service.adoc

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,138 @@ spec:
175175
- enp6s0.26
176176
EOF
177177
----
178+
179+
. Retrieve the nameserver records from the {dns_service} database to preserve DNS delegation:
180+
+
181+
----
182+
$ DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
183+
$ oc exec openstack-galera-0 -c galera -- mysql -rs -uroot -p"$DB_ROOT_PASSWORD" \
184+
-e "select a.hostname, a.priority from designate.pool_ns_records a;" > /tmp/designate_ns_records_raw.txt
185+
----
186+
187+
. Parse the nameserver records into YAML format for the {dns_service} CR:
188+
+
189+
----
190+
$ raw=/tmp/designate_ns_records_raw.txt
191+
$ out=/tmp/designate_ns_records.yaml
192+
$ if [ ! -s "$raw" ]; then
193+
echo "[]" > "$out"
194+
else
195+
awk '{ gsub(/\.$/, "", $1); if (NF >= 2) printf "- hostname: %s.\n priority: %s\n", $1, $2 }' "$raw" > "$out"
196+
fi
197+
----
198+
199+
. Enable the {dns_service} Redis instance in {rhocp_short}:
200+
+
201+
----
202+
$ oc patch openstackcontrolplane openstack --type=merge --patch '
203+
spec:
204+
redis:
205+
enabled: true
206+
templates:
207+
designate-redis:
208+
replicas: 1
209+
'
210+
----
211+
212+
. Wait for the {dns_service} Redis instance to become ready:
213+
+
214+
----
215+
$ oc wait --for condition=Ready --timeout=60s redises.redis.openstack.org/designate-redis
216+
----
217+
218+
. Create the {dns_service} CR patch file:
219+
+
220+
[subs="+quotes"]
221+
----
222+
$ cat > /tmp/designate_osp_patch.yaml << 'MAINCR'
223+
spec:
224+
designate:
225+
enabled: true
226+
template:
227+
designateAPI:
228+
networkAttachments:
229+
- internalapi
230+
designateWorker:
231+
networkAttachments:
232+
- designate
233+
replicas: 3
234+
designateCentral:
235+
replicas: 3
236+
designateProducer:
237+
replicas: 3
238+
designateBackendbind9:
239+
networkAttachments:
240+
- designate
241+
override:
242+
services:
243+
- metadata:
244+
annotations:
245+
metallb.universe.tf/address-pool: designateext
246+
metallb.universe.tf/allow-shared-ip: designateext
247+
metallb.universe.tf/loadBalancerIPs: 172.50.0.80
248+
- metadata:
249+
annotations:
250+
metallb.universe.tf/address-pool: designateext
251+
metallb.universe.tf/allow-shared-ip: designateext
252+
metallb.universe.tf/loadBalancerIPs: 172.50.0.81
253+
- metadata:
254+
annotations:
255+
metallb.universe.tf/address-pool: designateext
256+
metallb.universe.tf/allow-shared-ip: designateext
257+
metallb.universe.tf/loadBalancerIPs: 172.50.0.82
258+
replicas: 3
259+
storageClass: <storage_class>
260+
storageRequest: 10G
261+
designateMdns:
262+
networkAttachments:
263+
- designate
264+
replicas: 3
265+
designateUnbound:
266+
networkAttachments:
267+
- designate
268+
replicas: 2
269+
override:
270+
services:
271+
- metadata:
272+
annotations:
273+
metallb.universe.tf/address-pool: designateext
274+
metallb.universe.tf/allow-shared-ip: designateext
275+
metallb.universe.tf/loadBalancerIPs: 172.50.0.85
276+
- metadata:
277+
annotations:
278+
metallb.universe.tf/address-pool: designateext
279+
metallb.universe.tf/allow-shared-ip: designateext
280+
metallb.universe.tf/loadBalancerIPs: 172.50.0.86
281+
MAINCR
282+
----
283+
+
284+
where:
285+
286+
`<storage_class>`::
287+
Specifies the storage class name for persistent volumes (for example, `local-storage`).
288+
289+
. Append the nameserver records to the patch file:
290+
+
291+
----
292+
$ ns_yaml=/tmp/designate_ns_records.yaml
293+
$ patch_file=/tmp/designate_osp_patch.yaml
294+
$ echo ' nsRecords:' >> "$patch_file"
295+
$ if [ -s "$ns_yaml" ] && [ "$(cat "$ns_yaml")" != "[]" ]; then
296+
sed 's/^/ /' "$ns_yaml" >> "$patch_file"
297+
else
298+
echo ' []' >> "$patch_file"
299+
fi
300+
----
301+
302+
. Enable the {dns_service} in {rhocp_short}:
303+
+
304+
----
305+
$ oc patch openstackcontrolplane openstack --type=merge --patch-file /tmp/designate_osp_patch.yaml
306+
----
307+
308+
. Wait for the {dns_service} to become ready:
309+
+
310+
----
311+
$ oc wait --for condition=Ready --timeout=600s designate.designate.openstack.org/designate
312+
----
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
- name: Retrieve the known ns_record values from the designate database
2+
ansible.builtin.shell: |
3+
{{ shell_header }}
4+
{{ oc_header }}
5+
DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
6+
oc exec openstack-galera-0 -c galera -- mysql -rs -uroot -p"$DB_ROOT_PASSWORD" \
7+
-e "select a.hostname, a.priority from designate.pool_ns_records a;" > /tmp/designate_ns_records_raw.txt
8+
register: records_check_results
9+
changed_when: false
10+
11+
- name: Parse ns_record values into YAML format for CR
12+
ansible.builtin.shell: |
13+
set -e
14+
raw=/tmp/designate_ns_records_raw.txt
15+
out=/tmp/designate_ns_records.yaml
16+
if [ ! -s "$raw" ]; then
17+
echo "[]" > "$out"
18+
else
19+
awk '{ gsub(/\.$/, "", $1); if (NF >= 2) printf "- hostname: %s.\n priority: %s\n", $1, $2 }' "$raw" > "$out"
20+
fi
21+
args:
22+
executable: /bin/bash
23+
24+
- name: Enable the designate redis instance in OpenShift
25+
ansible.builtin.shell: |
26+
{{ shell_header }}
27+
{{ oc_header }}
28+
29+
oc patch openstackcontrolplane openstack --type=merge --patch '
30+
spec:
31+
redis:
32+
enabled: true
33+
templates:
34+
designate-redis:
35+
replicas: 1
36+
'
37+
register: designate_redis_config_results
38+
changed_when: true
39+
failed_when: designate_redis_config_results.rc != 0
40+
41+
- name: Wait for the designate redis instance to become ready
42+
ansible.builtin.shell: |
43+
{{ shell_header }}
44+
{{ oc_header }}
45+
46+
oc wait --for condition=Ready --timeout=60s redises.redis.openstack.org/designate-redis
47+
register: designate_redis_ready_result
48+
until: designate_redis_ready_result is success
49+
retries: 60
50+
delay: "{{ designate_retry_delay }}"
51+
52+
- name: Create designate OSP patch file (main CR)
53+
ansible.builtin.shell: |
54+
patch_file=/tmp/designate_osp_patch.yaml
55+
cat << MAINCR > "$patch_file"
56+
spec:
57+
designate:
58+
enabled: true
59+
template:
60+
designateAPI:
61+
networkAttachments:
62+
- internalapi
63+
designateWorker:
64+
networkAttachments:
65+
- designate
66+
replicas: 3
67+
designateCentral:
68+
replicas: 3
69+
designateProducer:
70+
replicas: 3
71+
designateBackendbind9:
72+
networkAttachments:
73+
- designate
74+
override:
75+
services:
76+
- metadata:
77+
annotations:
78+
metallb.universe.tf/address-pool: designateext
79+
metallb.universe.tf/allow-shared-ip: designateext
80+
metallb.universe.tf/loadBalancerIPs: 172.50.0.80
81+
- metadata:
82+
annotations:
83+
metallb.universe.tf/address-pool: designateext
84+
metallb.universe.tf/allow-shared-ip: designateext
85+
metallb.universe.tf/loadBalancerIPs: 172.50.0.81
86+
- metadata:
87+
annotations:
88+
metallb.universe.tf/address-pool: designateext
89+
metallb.universe.tf/allow-shared-ip: designateext
90+
metallb.universe.tf/loadBalancerIPs: 172.50.0.82
91+
replicas: 3
92+
storageClass: $STORAGE_CLASS_NAME
93+
storageRequest: 10G
94+
designateMdns:
95+
networkAttachments:
96+
- designate
97+
replicas: 3
98+
designateUnbound:
99+
networkAttachments:
100+
- designate
101+
replicas: 2
102+
override:
103+
services:
104+
- metadata:
105+
annotations:
106+
metallb.universe.tf/address-pool: designateext
107+
metallb.universe.tf/allow-shared-ip: designateext
108+
metallb.universe.tf/loadBalancerIPs: 172.50.0.85
109+
- metadata:
110+
annotations:
111+
metallb.universe.tf/address-pool: designateext
112+
metallb.universe.tf/allow-shared-ip: designateext
113+
metallb.universe.tf/loadBalancerIPs: 172.50.0.86
114+
MAINCR
115+
environment:
116+
STORAGE_CLASS_NAME: "{{ storage_class_name }}"
117+
118+
- name: Append nsRecords to designate OSP patch file
119+
ansible.builtin.shell: |
120+
ns_yaml=/tmp/designate_ns_records.yaml
121+
patch_file=/tmp/designate_osp_patch.yaml
122+
123+
echo ' nsRecords:' >> "$patch_file"
124+
if [ -s "$ns_yaml" ] && [ "$(cat "$ns_yaml")" != "[]" ]; then
125+
sed 's/^/ /' "$ns_yaml" >> "$patch_file"
126+
else
127+
echo ' []' >> "$patch_file"
128+
fi
129+
130+
- name: Enable designate service in OpenShift
131+
ansible.builtin.shell: |
132+
{{ shell_header }}
133+
{{ oc_header }}
134+
135+
oc patch openstackcontrolplane openstack --type=merge --patch-file /tmp/designate_osp_patch.yaml
136+
register: designate_service_config_results
137+
changed_when: true
138+
failed_when: designate_service_config_results.rc != 0
139+
140+
- name: Wait for the designate service to become ready
141+
ansible.builtin.shell: |
142+
{{ shell_header }}
143+
{{ oc_header }}
144+
145+
oc wait --for condition=Ready --timeout=60s designates.designate.openstack.org/designate
146+
register: designate_service_ready_result
147+
until: designate_service_ready_result is success
148+
retries: 60
149+
delay: "{{ designate_retry_delay }}"

tests/roles/designate_adoption/tasks/main.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
when: designate_adoption | bool
33
ansible.builtin.include_tasks:
44
file: designate_network_config.yaml
5+
6+
- name: Configure and enable Designate service
7+
when: designate_adoption | bool
8+
ansible.builtin.include_tasks:
9+
file: designate_cr_config.yaml

tests/roles/pcp_cleanup/defaults/main.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ reset_crc_storage: false
88
# Whether 'make standalone_revert' should be run before
99
# running the test suite.
1010
standalone_revert_enabled: false
11+
12+
# The number of peristent volumes to create if crc is being reset.
13+
crc_pv_num: 12

tests/roles/pcp_cleanup/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
cd {{ install_yamls_path }}
5757
# Try up to 3 times to clean up and recreate CRC storage, with a 5-second delay between attempts
5858
for i in {1..3}; do
59-
make crc_storage_cleanup crc_storage && break || sleep 5
59+
make crc_storage_cleanup crc_storage PV_NUM={{ crc_pv_num }} && break || sleep 5
6060
done
6161
{{ cells_env }}
6262
NAMESPACE={{ rhoso_namespace }} make namespace

0 commit comments

Comments
 (0)