Skip to content

Commit 4394d2a

Browse files
katarimanojkkarelyatin
authored andcommitted
Update endpoints in configure_object
Currently Configure_object task is only supporting greenfield where the service and endpoints are created. In case of adoption + ceph_migration, endpoints are created and we need to upate endpoints after redploying rgw (with tls). This patch allows cifmw code to update endpoints if they exists already.
1 parent b34fa2f commit 4394d2a

1 file changed

Lines changed: 55 additions & 1 deletion

File tree

roles/cifmw_cephadm/tasks/configure_object.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565
environment:
6666
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
6767
delegate_to: localhost
68-
when: cifmw_openshift_kubeconfig is defined
68+
when:
69+
- cifmw_openshift_kubeconfig is defined
70+
- swift_endpoints_count.stdout == "0"
6971
ansible.builtin.command: "oc -n {{ cifmw_cephadm_ns }} rsh openstackclient openstack {{ item.os_command }} show {{ item.os_command_object }} -c id -f value"
7072
register: all_uuids
7173
loop:
@@ -84,6 +86,58 @@
8486
- cifmw_cephadm_certificate | length > 0
8587
- cifmw_cephadm_key | length > 0
8688

89+
- name: Update Swift endpoints if exists
90+
delegate_to: localhost
91+
when:
92+
- cifmw_openshift_kubeconfig is defined
93+
- not swift_in_ctlplane.stdout | bool
94+
- swift_endpoints_count.stdout != "0"
95+
block:
96+
- name: Get UUID for Swift 'public' endpoint
97+
environment:
98+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
99+
ansible.builtin.shell: |
100+
set -euo pipefail
101+
oc exec -t openstackclient -- \
102+
openstack endpoint list -f json | \
103+
jq -r '.[] | select(.["Service Name"] == "swift" and .Interface == "public") | .ID'
104+
register: uuid_swift_public_ep
105+
changed_when: false
106+
107+
- name: Get UUID for Swift 'internal' endpoint
108+
environment:
109+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
110+
ansible.builtin.shell: |
111+
set -euo pipefail
112+
oc exec -t openstackclient -- \
113+
openstack endpoint list -f json | \
114+
jq -r '.[] | select(.["Service Name"] == "swift" and .Interface == "internal") | .ID'
115+
register: uuid_swift_internal_ep
116+
changed_when: false
117+
118+
- name: Update Swift endpoints url
119+
cifmw.general.ci_script:
120+
extra_args:
121+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
122+
output_dir: "/home/zuul/ci-framework-data/artifacts"
123+
script: |-
124+
oc -n {{ cifmw_cephadm_ns }} rsh openstackclient \
125+
openstack endpoint set \
126+
--url {{ cifmw_cephadm_urischeme }}://{{ (
127+
cifmw_external_dns_vip_ext.values() | first
128+
if cifmw_external_dns_vip_ext is defined
129+
else cifmw_cephadm_rgw_vip | ansible.utils.ipaddr('address')
130+
) }}:8080/swift/v1/AUTH_%\(tenant_id\)s \
131+
{{ uuid_swift_public_ep.stdout }}
132+
oc -n {{ cifmw_cephadm_ns }} rsh openstackclient \
133+
openstack endpoint set \
134+
--url {{ cifmw_cephadm_urischeme }}://{{ (
135+
cifmw_external_dns_vip_int.values() | first
136+
if cifmw_external_dns_vip_int is defined
137+
else cifmw_cephadm_rgw_vip | ansible.utils.ipaddr('address')
138+
) }}:8080/swift/v1/AUTH_%\(tenant_id\)s \
139+
{{ uuid_swift_internal_ep.stdout }}
140+
87141
- name: Configure object store to use rgw
88142
cifmw.general.ci_script:
89143
extra_args:

0 commit comments

Comments
 (0)