Skip to content

Commit 80ec07e

Browse files
committed
Enable designate redis and designate instance.
This patch uses existing nsRecords from the designate data that should have been copied at this point. This is really the only authoritative source. Note: patch also provides a mechanism for altering the number of PVs.
1 parent e0d7bc1 commit 80ec07e

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
@@ -172,3 +172,138 @@ spec:
172172
- enp6s0.26
173173
EOF
174174
----
175+
176+
. Retrieve the nameserver records from the {dns_service} database to preserve DNS delegation:
177+
+
178+
----
179+
$ DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
180+
$ oc exec openstack-default-galera-0 -c galera -- mysql -rs -uroot -p"$DB_ROOT_PASSWORD" \
181+
-e "select a.hostname, a.priority from designate.pool_ns_records a;" > /tmp/designate_ns_records_raw.txt
182+
----
183+
184+
. Parse the nameserver records into YAML format for the {dns_service} CR:
185+
+
186+
----
187+
$ raw=/tmp/designate_ns_records_raw.txt
188+
$ out=/tmp/designate_ns_records.yaml
189+
$ if [ ! -s "$raw" ]; then
190+
echo "[]" > "$out"
191+
else
192+
awk '{ gsub(/\.$/, "", $1); if (NF >= 2) printf "- hostname: %s.\n priority: %s\n", $1, $2 }' "$raw" > "$out"
193+
fi
194+
----
195+
196+
. Enable the {dns_service} Redis instance in {rhocp_short}:
197+
+
198+
----
199+
$ oc patch openstackcontrolplane openstack --type=merge --patch '
200+
spec:
201+
redis:
202+
enabled: true
203+
templates:
204+
designate-redis:
205+
replicas: 1
206+
'
207+
----
208+
209+
. Wait for the {dns_service} Redis instance to become ready:
210+
+
211+
----
212+
$ oc wait --for condition=Ready --timeout=60s redises.redis.openstack.org/designate-redis
213+
----
214+
215+
. Create the {dns_service} CR patch file:
216+
+
217+
[NOTE]
218+
====
219+
Replace `<storage_class>` with the storage class name for persistent volumes (for example, `local-storage`).
220+
====
221+
+
222+
[subs="+quotes"]
223+
----
224+
$ cat > /tmp/designate_osp_patch.yaml << 'MAINCR'
225+
spec:
226+
designate:
227+
enabled: true
228+
template:
229+
designateAPI:
230+
networkAttachments:
231+
- internalapi
232+
designateWorker:
233+
networkAttachments:
234+
- designate
235+
replicas: 3
236+
designateCentral:
237+
replicas: 3
238+
designateProducer:
239+
replicas: 3
240+
designateBackendbind9:
241+
networkAttachments:
242+
- designate
243+
override:
244+
services:
245+
- metadata:
246+
annotations:
247+
metallb.universe.tf/address-pool: designateext
248+
metallb.universe.tf/allow-shared-ip: designateext
249+
metallb.universe.tf/loadBalancerIPs: 172.50.0.80
250+
- metadata:
251+
annotations:
252+
metallb.universe.tf/address-pool: designateext
253+
metallb.universe.tf/allow-shared-ip: designateext
254+
metallb.universe.tf/loadBalancerIPs: 172.50.0.81
255+
- metadata:
256+
annotations:
257+
metallb.universe.tf/address-pool: designateext
258+
metallb.universe.tf/allow-shared-ip: designateext
259+
metallb.universe.tf/loadBalancerIPs: 172.50.0.82
260+
replicas: 3
261+
storageClass: <storage_class>
262+
storageRequest: 10G
263+
designateMdns:
264+
networkAttachments:
265+
- designate
266+
replicas: 3
267+
designateUnbound:
268+
networkAttachments:
269+
- designate
270+
replicas: 2
271+
override:
272+
services:
273+
- metadata:
274+
annotations:
275+
metallb.universe.tf/address-pool: designateext
276+
metallb.universe.tf/allow-shared-ip: designateext
277+
metallb.universe.tf/loadBalancerIPs: 172.50.0.85
278+
- metadata:
279+
annotations:
280+
metallb.universe.tf/address-pool: designateext
281+
metallb.universe.tf/allow-shared-ip: designateext
282+
metallb.universe.tf/loadBalancerIPs: 172.50.0.86
283+
MAINCR
284+
----
285+
286+
. Append the nameserver records to the patch file:
287+
+
288+
----
289+
$ ns_yaml=/tmp/designate_ns_records.yaml
290+
$ patch_file=/tmp/designate_osp_patch.yaml
291+
$ echo ' nsRecords:' >> "$patch_file"
292+
$ if [ -s "$ns_yaml" ] && [ "$(cat "$ns_yaml")" != "[]" ]; then
293+
sed 's/^/ /' "$ns_yaml" >> "$patch_file"
294+
else
295+
echo ' []' >> "$patch_file"
296+
fi
297+
----
298+
299+
. Enable the {dns_service} in {rhocp_short}:
300+
+
301+
----
302+
$ oc patch openstackcontrolplane openstack --type=merge --patch-file /tmp/designate_osp_patch.yaml
303+
----
304+
305+
. Wait for the {dns_service} to become ready:
306+
+
307+
----
308+
$ oc wait --for condition=Ready --timeout=600s designate.designate.openstack.org/designate
309+
----
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)