-
Notifications
You must be signed in to change notification settings - Fork 85
Add test role for converting external Swift storage nodes #1356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 1 commit into
openstack-k8s-operators:main
from
cschwede:swift-conversion-tests
Apr 16, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| - name: Swift conversion | ||
| hosts: local | ||
| gather_facts: false | ||
| force_handlers: true | ||
| module_defaults: | ||
| ansible.builtin.shell: | ||
| executable: /bin/bash | ||
| roles: | ||
| - role: swift_conversion | ||
| tags: | ||
| - swift_conversion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| ansible_ssh_private_key_secret: dataplane-adoption-secret | ||
|
|
||
| default_timesync_ntp_servers: | ||
| - hostname: pool.ntp.org | ||
|
|
||
| swift_conversion_nodeset_name: openstack-edpm-ipam | ||
| swift_conversion_deployment_name: openstack-edpm-ipam | ||
|
|
||
| edpm_node_hostname: edpm-swift-0 | ||
| edpm_user: root | ||
|
|
||
| edpm_bootstrap_command: | | ||
| # This is a hack to deploy RDO Delorean repos to RHEL as if it were Centos 9 Stream | ||
| set -euxo pipefail | ||
| curl -sL https://github.com/openstack-k8s-operators/repo-setup/archive/refs/heads/main.tar.gz | tar -xz | ||
| python3 -m venv ./venv | ||
| PBR_VERSION=0.0.0 ./venv/bin/pip install ./repo-setup-main | ||
| # This is required for FIPS enabled until trunk.rdoproject.org | ||
| # is not being served from a centos7 host, tracked by | ||
| # https://issues.redhat.com/browse/RHOSZUUL-1517 | ||
| dnf -y install crypto-policies | ||
| update-crypto-policies --set FIPS:NO-ENFORCE-EMS | ||
| ./venv/bin/repo-setup current-podified -b antelope -d centos9 --stream | ||
| rm -rf repo-setup-main | ||
|
|
||
| swift_conversion_nodeset: | | ||
| apiVersion: dataplane.openstack.org/v1beta1 | ||
| kind: OpenStackDataPlaneNodeSet | ||
| metadata: | ||
| name: {{ swift_conversion_nodeset_name }} | ||
| spec: | ||
| preProvisioned: true | ||
| networkAttachments: | ||
| - ctlplane | ||
| - storage | ||
| nodeTemplate: | ||
| ansible: | ||
| ansibleUser: {{ edpm_user }} | ||
| ansibleVars: | ||
| edpm_swift_disks: [] | ||
| edpm_bootstrap_release_version_package: [] | ||
| edpm_bootstrap_command: | | ||
| {{ edpm_bootstrap_command| indent(10) }} | ||
| edpm_nodes_validation_validate_controllers_icmp: false | ||
| edpm_nodes_validation_validate_gateway_icmp: false | ||
| edpm_service_removal_skip_list: | ||
| - tripleo-container-shutdown.service | ||
| edpm_sshd_allowed_ranges: | ||
| - 192.168.122.0/24 | ||
| enable_debug: false | ||
| gather_facts: false | ||
| timesync_ntp_servers: {{ timesync_ntp_servers | default(default_timesync_ntp_servers) }} | ||
| ansibleSSHPrivateKeySecret: {{ ansible_ssh_private_key_secret }} | ||
| managementNetwork: ctlplane | ||
| nodes: | ||
| standalone: | ||
| ansible: | ||
| ansibleHost: "{{ standalone_ip | default(edpm_node_ip) }}" | ||
| ansibleVars: | ||
| edpm_swift_disks: [] | ||
| hostName: "{{ edpm_node_hostname }}" | ||
| networks: | ||
| - defaultRoute: true | ||
| fixedIP: "{{ standalone_ip | default(edpm_node_ip) }}" | ||
| name: ctlplane | ||
| subnetName: subnet1 | ||
| - name: internalapi | ||
| subnetName: subnet2 | ||
| - name: storage | ||
| subnetName: subnet3 | ||
| - name: tenant | ||
| subnetName: subnet4 | ||
| services: | ||
| - bootstrap | ||
| - download-cache | ||
| - install-os | ||
| - configure-os | ||
| - ssh-known-hosts | ||
| - run-os | ||
| - reboot-os | ||
| - install-certs | ||
| - tripleo-cleanup | ||
| - swift | ||
| tlsEnabled: {{ enable_tlse }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| dependencies: | ||
| - role: common_defaults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| - name: Patch the OpenStackControlPlane CR to change the Swift default storage ports | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| {{ oc_header }} | ||
| {{ cells_env }} | ||
|
|
||
| cat > swift-config-patch.yaml << EOF | ||
| spec: | ||
| swift: | ||
| template: | ||
| swiftStorage: | ||
| defaultConfigOverwrite: | ||
| 01-account-server.conf: | | ||
| [DEFAULT] | ||
| bind_port = 6002 | ||
| 01-container-server.conf: | | ||
| [DEFAULT] | ||
| bind_port = 6001 | ||
| 01-object-server.conf: | | ||
| [DEFAULT] | ||
| bind_port = 6000 | ||
| EOF | ||
|
|
||
| - name: Apply the patch file | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| {{ oc_header }} | ||
| oc patch openstackcontrolplane openstack --type=merge --patch-file=swift-config-patch.yaml | ||
|
|
||
| - name: Create OpenStackDataPlaneNodeSet for Swift node conversion | ||
| no_log: "{{ use_no_log }}" | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| {{ oc_header }} | ||
| oc apply -f - <<EOF | ||
| {{ swift_conversion_nodeset }} | ||
| EOF | ||
|
|
||
| - name: Create OpenStackDataPlaneDeployment to trigger conversion | ||
| no_log: "{{ use_no_log }}" | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| {{ oc_header }} | ||
| oc apply -f - <<EOF | ||
| apiVersion: dataplane.openstack.org/v1beta1 | ||
| kind: OpenStackDataPlaneDeployment | ||
| metadata: | ||
| name: {{ swift_conversion_deployment_name }} | ||
| namespace: openstack | ||
| spec: | ||
| nodeSets: | ||
| - {{ swift_conversion_nodeset_name }} | ||
| EOF | ||
|
|
||
| - name: Wait for the Swift node conversion deployment to finish | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| {{ oc_header }} | ||
| oc wait --for condition=Ready openstackdataplanedeployment/{{ swift_conversion_deployment_name }} --timeout=30m | ||
|
|
||
| - name: Verify Swift services are running on converted node | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| ssh -o StrictHostKeyChecking=accept-new -i {{ edpm_privatekey_path }} {{ edpm_user }}@{{ standalone_ip | default(edpm_node_ip) }} "sudo systemctl status edpm_swift_*" | ||
|
|
||
| - name: Verify Swift is still functional after conversion | ||
| ansible.builtin.shell: | | ||
| {{ shell_header }} | ||
| {{ oc_header }} | ||
| oc rsh openstackclient /bin/sh -c "touch obj && openstack container create cont && openstack object create cont obj" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if all these general variables should be defaulted inside the role, but given that this role is used in isolation (its own playbook and make target), it's probably ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree, and I was a bit hesitant as well. At the end I basically used the same approach as the dataplane_adoption role, and as you wrote this runs in isolation - that worked fine during my tests.