Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions docs_user/modules/proc_adopting-the-dns-service.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,138 @@ spec:
- enp6s0.26
EOF
----

. Retrieve the nameserver records from the {dns_service} database to preserve DNS delegation:
+
----
$ DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
$ oc exec openstack-galera-0 -c galera -- mysql -rs -uroot -p"$DB_ROOT_PASSWORD" \
-e "select a.hostname, a.priority from designate.pool_ns_records a;" > /tmp/designate_ns_records_raw.txt
----

. Parse the nameserver records into YAML format for the {dns_service} CR:
+
----
$ raw=/tmp/designate_ns_records_raw.txt
$ out=/tmp/designate_ns_records.yaml
$ if [ ! -s "$raw" ]; then
echo "[]" > "$out"
else
awk '{ gsub(/\.$/, "", $1); if (NF >= 2) printf "- hostname: %s.\n priority: %s\n", $1, $2 }' "$raw" > "$out"
fi
----

. Enable the {dns_service} Redis instance in {rhocp_short}:
+
----
$ oc patch openstackcontrolplane openstack --type=merge --patch '
spec:
redis:
enabled: true
templates:
designate-redis:
replicas: 1
'
----

. Wait for the {dns_service} Redis instance to become ready:
+
----
$ oc wait --for condition=Ready --timeout=60s redises.redis.openstack.org/designate-redis
----

. Create the {dns_service} CR patch file:
+
[subs="+quotes"]
----
$ cat > /tmp/designate_osp_patch.yaml << 'MAINCR'
spec:
designate:
enabled: true
template:
designateAPI:
networkAttachments:
- internalapi
designateWorker:
networkAttachments:
- designate
replicas: 3
designateCentral:
replicas: 3
designateProducer:
replicas: 3
designateBackendbind9:
networkAttachments:
- designate
override:
services:
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.80
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.81
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.82
replicas: 3
storageClass: <storage_class>
storageRequest: 10G
designateMdns:
networkAttachments:
- designate
replicas: 3
designateUnbound:
networkAttachments:
- designate
replicas: 2
override:
services:
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.85
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.86
MAINCR
----
+
where:

`<storage_class>`::
Specifies the storage class name for persistent volumes (for example, `local-storage`).

Comment thread
beagles marked this conversation as resolved.
. Append the nameserver records to the patch file:
+
----
$ ns_yaml=/tmp/designate_ns_records.yaml
$ patch_file=/tmp/designate_osp_patch.yaml
$ echo ' nsRecords:' >> "$patch_file"
$ if [ -s "$ns_yaml" ] && [ "$(cat "$ns_yaml")" != "[]" ]; then
sed 's/^/ /' "$ns_yaml" >> "$patch_file"
else
echo ' []' >> "$patch_file"
fi
----

. Enable the {dns_service} in {rhocp_short}:
+
----
$ oc patch openstackcontrolplane openstack --type=merge --patch-file /tmp/designate_osp_patch.yaml
----

. Wait for the {dns_service} to become ready:
+
----
$ oc wait --for condition=Ready --timeout=600s designate.designate.openstack.org/designate
----
149 changes: 149 additions & 0 deletions tests/roles/designate_adoption/tasks/designate_cr_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
- name: Retrieve the known ns_record values from the designate database
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}
DB_ROOT_PASSWORD=$(oc get -o json secret/osp-secret | jq -r .data.DbRootPassword | base64 -d)
oc exec openstack-galera-0 -c galera -- mysql -rs -uroot -p"$DB_ROOT_PASSWORD" \
-e "select a.hostname, a.priority from designate.pool_ns_records a;" > /tmp/designate_ns_records_raw.txt
register: records_check_results
changed_when: false

- name: Parse ns_record values into YAML format for CR
ansible.builtin.shell: |
set -e
raw=/tmp/designate_ns_records_raw.txt
out=/tmp/designate_ns_records.yaml
if [ ! -s "$raw" ]; then
echo "[]" > "$out"
else
awk '{ gsub(/\.$/, "", $1); if (NF >= 2) printf "- hostname: %s.\n priority: %s\n", $1, $2 }' "$raw" > "$out"
fi
args:
executable: /bin/bash

- name: Enable the designate redis instance in OpenShift
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}

oc patch openstackcontrolplane openstack --type=merge --patch '
spec:
redis:
enabled: true
templates:
designate-redis:
replicas: 1
'
register: designate_redis_config_results
changed_when: true
failed_when: designate_redis_config_results.rc != 0

- name: Wait for the designate redis instance to become ready
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}

oc wait --for condition=Ready --timeout=60s redises.redis.openstack.org/designate-redis
register: designate_redis_ready_result
until: designate_redis_ready_result is success
retries: 60
delay: "{{ designate_retry_delay }}"

- name: Create designate OSP patch file (main CR)
ansible.builtin.shell: |
patch_file=/tmp/designate_osp_patch.yaml
cat << MAINCR > "$patch_file"
spec:
designate:
enabled: true
template:
designateAPI:
networkAttachments:
- internalapi
designateWorker:
networkAttachments:
- designate
replicas: 3
designateCentral:
replicas: 3
designateProducer:
replicas: 3
designateBackendbind9:
networkAttachments:
- designate
override:
services:
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.80
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.81
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.82
replicas: 3
storageClass: $STORAGE_CLASS_NAME
storageRequest: 10G
designateMdns:
networkAttachments:
- designate
replicas: 3
designateUnbound:
networkAttachments:
- designate
replicas: 2
override:
services:
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.85
- metadata:
annotations:
metallb.universe.tf/address-pool: designateext
metallb.universe.tf/allow-shared-ip: designateext
metallb.universe.tf/loadBalancerIPs: 172.50.0.86
MAINCR
environment:
STORAGE_CLASS_NAME: "{{ storage_class_name }}"

- name: Append nsRecords to designate OSP patch file
ansible.builtin.shell: |
ns_yaml=/tmp/designate_ns_records.yaml
patch_file=/tmp/designate_osp_patch.yaml

echo ' nsRecords:' >> "$patch_file"
if [ -s "$ns_yaml" ] && [ "$(cat "$ns_yaml")" != "[]" ]; then
sed 's/^/ /' "$ns_yaml" >> "$patch_file"
else
echo ' []' >> "$patch_file"
fi

- name: Enable designate service in OpenShift
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}

oc patch openstackcontrolplane openstack --type=merge --patch-file /tmp/designate_osp_patch.yaml
register: designate_service_config_results
changed_when: true
failed_when: designate_service_config_results.rc != 0

- name: Wait for the designate service to become ready
ansible.builtin.shell: |
{{ shell_header }}
{{ oc_header }}

oc wait --for condition=Ready --timeout=60s designates.designate.openstack.org/designate
register: designate_service_ready_result
until: designate_service_ready_result is success
retries: 60
delay: "{{ designate_retry_delay }}"
5 changes: 5 additions & 0 deletions tests/roles/designate_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
when: designate_adoption | bool
ansible.builtin.include_tasks:
file: designate_network_config.yaml

- name: Configure and enable Designate service
when: designate_adoption | bool
ansible.builtin.include_tasks:
file: designate_cr_config.yaml
3 changes: 3 additions & 0 deletions tests/roles/pcp_cleanup/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ reset_crc_storage: false
# Whether 'make standalone_revert' should be run before
# running the test suite.
standalone_revert_enabled: false

# The number of peristent volumes to create if crc is being reset.
crc_pv_num: 12
Comment thread
ciecierski marked this conversation as resolved.
2 changes: 1 addition & 1 deletion tests/roles/pcp_cleanup/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
cd {{ install_yamls_path }}
# Try up to 3 times to clean up and recreate CRC storage, with a 5-second delay between attempts
for i in {1..3}; do
make crc_storage_cleanup crc_storage && break || sleep 5
make crc_storage_cleanup crc_storage PV_NUM={{ crc_pv_num }} && break || sleep 5
done
{{ cells_env }}
NAMESPACE={{ rhoso_namespace }} make namespace
Expand Down
Loading