Skip to content

Commit cafc332

Browse files
Merge pull request #1356 from cschwede/swift-conversion-tests
Add test role for converting external Swift storage nodes
2 parents 911c716 + 4c0fbac commit cafc332

5 files changed

Lines changed: 173 additions & 0 deletions

File tree

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ test-swift-migration:
6464
mkdir -p tests/logs
6565
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_SECRETS) -e @$(TEST_VARS) $(TEST_ARGS) tests/playbooks/test_swift_migration.yaml 2>&1 | tee $(TEST_OUTFILE)
6666

67+
test-swift-conversion: TEST_OUTFILE ?= tests/logs/test_swift_conversion_out_$(shell date +%FT%T%Z).log
68+
test-swift-conversion:
69+
mkdir -p tests/logs
70+
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_SECRETS) -e @$(TEST_VARS) $(TEST_ARGS) tests/playbooks/test_swift_conversion.yaml 2>&1 | tee $(TEST_OUTFILE)
71+
6772
test-ocp-as-gw: TEST_OUTFILE ?= tests/logs/test_ocp_as_gw_out_$(shell date +%FT%T%Z).log
6873
test-ocp-as-gw: ## Launch test suite related to the ocp gateways
6974
mkdir -p tests/logs
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- name: Swift conversion
2+
hosts: local
3+
gather_facts: false
4+
force_handlers: true
5+
module_defaults:
6+
ansible.builtin.shell:
7+
executable: /bin/bash
8+
roles:
9+
- role: swift_conversion
10+
tags:
11+
- swift_conversion
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
ansible_ssh_private_key_secret: dataplane-adoption-secret
3+
4+
default_timesync_ntp_servers:
5+
- hostname: pool.ntp.org
6+
7+
swift_conversion_nodeset_name: openstack-edpm-ipam
8+
swift_conversion_deployment_name: openstack-edpm-ipam
9+
10+
edpm_node_hostname: edpm-swift-0
11+
edpm_user: root
12+
13+
edpm_bootstrap_command: |
14+
# This is a hack to deploy RDO Delorean repos to RHEL as if it were Centos 9 Stream
15+
set -euxo pipefail
16+
curl -sL https://github.com/openstack-k8s-operators/repo-setup/archive/refs/heads/main.tar.gz | tar -xz
17+
python3 -m venv ./venv
18+
PBR_VERSION=0.0.0 ./venv/bin/pip install ./repo-setup-main
19+
# This is required for FIPS enabled until trunk.rdoproject.org
20+
# is not being served from a centos7 host, tracked by
21+
# https://issues.redhat.com/browse/RHOSZUUL-1517
22+
dnf -y install crypto-policies
23+
update-crypto-policies --set FIPS:NO-ENFORCE-EMS
24+
./venv/bin/repo-setup current-podified -b antelope -d centos9 --stream
25+
rm -rf repo-setup-main
26+
27+
swift_conversion_nodeset: |
28+
apiVersion: dataplane.openstack.org/v1beta1
29+
kind: OpenStackDataPlaneNodeSet
30+
metadata:
31+
name: {{ swift_conversion_nodeset_name }}
32+
spec:
33+
preProvisioned: true
34+
networkAttachments:
35+
- ctlplane
36+
- storage
37+
nodeTemplate:
38+
ansible:
39+
ansibleUser: {{ edpm_user }}
40+
ansibleVars:
41+
edpm_swift_disks: []
42+
edpm_bootstrap_release_version_package: []
43+
edpm_bootstrap_command: |
44+
{{ edpm_bootstrap_command| indent(10) }}
45+
edpm_nodes_validation_validate_controllers_icmp: false
46+
edpm_nodes_validation_validate_gateway_icmp: false
47+
edpm_service_removal_skip_list:
48+
- tripleo-container-shutdown.service
49+
edpm_sshd_allowed_ranges:
50+
- 192.168.122.0/24
51+
enable_debug: false
52+
gather_facts: false
53+
timesync_ntp_servers: {{ timesync_ntp_servers | default(default_timesync_ntp_servers) }}
54+
ansibleSSHPrivateKeySecret: {{ ansible_ssh_private_key_secret }}
55+
managementNetwork: ctlplane
56+
nodes:
57+
standalone:
58+
ansible:
59+
ansibleHost: "{{ standalone_ip | default(edpm_node_ip) }}"
60+
ansibleVars:
61+
edpm_swift_disks: []
62+
hostName: "{{ edpm_node_hostname }}"
63+
networks:
64+
- defaultRoute: true
65+
fixedIP: "{{ standalone_ip | default(edpm_node_ip) }}"
66+
name: ctlplane
67+
subnetName: subnet1
68+
- name: internalapi
69+
subnetName: subnet2
70+
- name: storage
71+
subnetName: subnet3
72+
- name: tenant
73+
subnetName: subnet4
74+
services:
75+
- bootstrap
76+
- download-cache
77+
- install-os
78+
- configure-os
79+
- ssh-known-hosts
80+
- run-os
81+
- reboot-os
82+
- install-certs
83+
- tripleo-cleanup
84+
- swift
85+
tlsEnabled: {{ enable_tlse }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dependencies:
2+
- role: common_defaults
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
- name: Patch the OpenStackControlPlane CR to change the Swift default storage ports
2+
ansible.builtin.shell: |
3+
{{ shell_header }}
4+
{{ oc_header }}
5+
{{ cells_env }}
6+
7+
cat > swift-config-patch.yaml << EOF
8+
spec:
9+
swift:
10+
template:
11+
swiftStorage:
12+
defaultConfigOverwrite:
13+
01-account-server.conf: |
14+
[DEFAULT]
15+
bind_port = 6002
16+
01-container-server.conf: |
17+
[DEFAULT]
18+
bind_port = 6001
19+
01-object-server.conf: |
20+
[DEFAULT]
21+
bind_port = 6000
22+
EOF
23+
24+
- name: Apply the patch file
25+
ansible.builtin.shell: |
26+
{{ shell_header }}
27+
{{ oc_header }}
28+
oc patch openstackcontrolplane openstack --type=merge --patch-file=swift-config-patch.yaml
29+
30+
- name: Create OpenStackDataPlaneNodeSet for Swift node conversion
31+
no_log: "{{ use_no_log }}"
32+
ansible.builtin.shell: |
33+
{{ shell_header }}
34+
{{ oc_header }}
35+
oc apply -f - <<EOF
36+
{{ swift_conversion_nodeset }}
37+
EOF
38+
39+
- name: Create OpenStackDataPlaneDeployment to trigger conversion
40+
no_log: "{{ use_no_log }}"
41+
ansible.builtin.shell: |
42+
{{ shell_header }}
43+
{{ oc_header }}
44+
oc apply -f - <<EOF
45+
apiVersion: dataplane.openstack.org/v1beta1
46+
kind: OpenStackDataPlaneDeployment
47+
metadata:
48+
name: {{ swift_conversion_deployment_name }}
49+
namespace: openstack
50+
spec:
51+
nodeSets:
52+
- {{ swift_conversion_nodeset_name }}
53+
EOF
54+
55+
- name: Wait for the Swift node conversion deployment to finish
56+
ansible.builtin.shell: |
57+
{{ shell_header }}
58+
{{ oc_header }}
59+
oc wait --for condition=Ready openstackdataplanedeployment/{{ swift_conversion_deployment_name }} --timeout=30m
60+
61+
- name: Verify Swift services are running on converted node
62+
ansible.builtin.shell: |
63+
{{ shell_header }}
64+
ssh -o StrictHostKeyChecking=accept-new -i {{ edpm_privatekey_path }} {{ edpm_user }}@{{ standalone_ip | default(edpm_node_ip) }} "sudo systemctl status edpm_swift_*"
65+
66+
- name: Verify Swift is still functional after conversion
67+
ansible.builtin.shell: |
68+
{{ shell_header }}
69+
{{ oc_header }}
70+
oc rsh openstackclient /bin/sh -c "touch obj && openstack container create cont && openstack object create cont obj"

0 commit comments

Comments
 (0)