Skip to content

Commit

Permalink
Collect image for OpenStack init controller pod separately
Browse files Browse the repository at this point in the history
  • Loading branch information
abays committed Jan 7, 2025
1 parent 556924a commit b01d110
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion roles/env_op_images/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
selected_pods: "{{ pod_list.resources |
rejectattr('metadata.generateName', 'contains', 'openstack-operator-index-') |
rejectattr('metadata.generateName', 'contains', 'rabbitmq-cluster-operator-') |
rejectattr('metadata.generateName', 'contains', 'watcher-operator-index-')
rejectattr('metadata.generateName', 'contains', 'watcher-operator-index-') |
rejectattr('metadata.generateName', 'contains', 'openstack-operator-controller-operator-')
}}"

- name: Add operator images to the dictionary
Expand All @@ -139,6 +140,26 @@
loop_control:
label: "{{ item.metadata.name }}"

# Special case: separately get image for OpenStack init controller manager, since it only has 1 container
# and therefore cannot be collected in the task above (which would reference a non-existent second container
# and throw an error)
- name: Get OpenStack init operator image
when:
- not cifmw_env_op_images_dryrun | bool
- pod_list.resources | selectattr('metadata.generateName', 'contains', 'openstack-operator-controller-operator-') | list | length != 0
vars:
selected_pod: "{{ pod_list.resources | selectattr('metadata.generateName', 'contains', 'openstack-operator-controller-operator-') | list | first }}"
ansible.builtin.set_fact:
cifmw_openstack_operator_images_content: >-
{{
cifmw_openstack_operator_images_content |
combine(
{
selected_pod.metadata.labels['openstack.org/operator-name'] | upper ~ '_OP_IMG': selected_pod.status.containerStatuses[0].imageID
}
)
}}
- name: Write images to file
vars:
_content:
Expand Down

0 comments on commit b01d110

Please sign in to comment.