-
Notifications
You must be signed in to change notification settings - Fork 153
[cinder_multiattach] Wait for Glance reconciliation after config patch #4060
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,16 @@ | |
| - name: Block to configure cinder_volume_type when needed | ||
| when: configure_cinder_volume_type | default(false) | bool | ||
| block: | ||
| - name: Get OpenStackControlPlane CR name | ||
| environment: | ||
| KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" | ||
| PATH: "{{ cifmw_path }}" | ||
| ansible.builtin.shell: | | ||
| set -xe -o pipefail | ||
| oc get openstackcontrolplane -o name -n {{ namespace }} | ||
| register: _ctlplane_name | ||
| changed_when: false | ||
|
|
||
| - name: Create tempfile | ||
| ansible.builtin.tempfile: | ||
| state: file | ||
|
|
@@ -37,8 +47,7 @@ | |
| - name: Write current glance customServiceConfig to tempfile | ||
| ansible.builtin.shell: | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (non-blocking) thought would be awesome if we refactor this eventually! to follow a more ansible idiomantic approach |
||
| set -xe -o pipefail | ||
| crname=$(oc get openstackcontrolplane -o name -n {{ namespace }}) | ||
| oc -n {{ namespace }} get ${crname} -o jsonpath={.spec.glance.template.customServiceConfig} > {{ _glance_custom_service_config_file.path }} | ||
| oc -n {{ namespace }} get {{ _ctlplane_name.stdout }} -o jsonpath={.spec.glance.template.customServiceConfig} > {{ _glance_custom_service_config_file.path }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: this is much better!! |
||
| changed_when: false | ||
|
|
||
| - name: Ensure cinder_volume_type is configured with proper value in tempfile | ||
|
|
@@ -65,8 +74,44 @@ | |
| customServiceConfig: "{{ _glance_ini_content.content | b64decode }}" | ||
| ansible.builtin.shell: | | ||
| set -xe -o pipefail | ||
| crname=$(oc get openstackcontrolplane -o name -n {{ namespace }}) | ||
| oc -n {{ namespace }} patch ${crname} --type=merge --patch "{{ _yaml_patch | to_nice_yaml }}" | ||
| oc -n {{ namespace }} wait ${crname} --for condition=Ready --timeout=10m | ||
| oc -n {{ namespace }} patch {{ _ctlplane_name.stdout }} --type=merge --patch "{{ _yaml_patch | to_nice_yaml }}" | ||
| changed_when: _glance_ini_file.changed | ||
| when: _glance_ini_file.changed | ||
|
|
||
| # After patching the controlplane, there is a window where both | ||
| # Glance and the controlplane still report Ready because the | ||
| # reconciliation has not propagated yet. Wait for Glance to | ||
| # enter reconciliation (Ready=False) before waiting for it | ||
| # and the controlplane to become Ready again. | ||
| - name: Get Glance CR name # noqa: no-handler | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (blocking) suggestion: can we use k8s_info? |
||
| environment: | ||
| KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" | ||
| PATH: "{{ cifmw_path }}" | ||
| ansible.builtin.shell: | | ||
| set -xe -o pipefail | ||
| oc -n {{ namespace }} get glance -o name | ||
| register: _glance_name | ||
| changed_when: false | ||
| when: _glance_ini_file.changed | ||
|
|
||
| - name: Wait for Glance reconciliation to start # noqa: no-handler | ||
| environment: | ||
| KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" | ||
| PATH: "{{ cifmw_path }}" | ||
| ansible.builtin.shell: | | ||
| set -xe -o pipefail | ||
| oc -n {{ namespace }} wait {{ _glance_name.stdout }} \ | ||
| --for=condition=Ready=False --timeout=5m | ||
| when: _glance_ini_file.changed | ||
|
|
||
| - name: Wait for Glance and the ctlplane to complete reconciliation # noqa: no-handler | ||
| environment: | ||
| KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" | ||
| PATH: "{{ cifmw_path }}" | ||
| ansible.builtin.shell: | | ||
| set -xe -o pipefail | ||
| oc -n {{ namespace }} wait {{ item }} --for condition=Ready --timeout=10m | ||
| loop: | ||
| - "{{ _glance_name.stdout }}" | ||
| - "{{ _ctlplane_name.stdout }}" | ||
| when: _glance_ini_file.changed | ||
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.
(blocking) suggestion: Could you use ansible k8s_info?
(non-blocking) Do we want to add retry logic?