Skip to content

Commit a7af7d8

Browse files
Jenkinsmnietoji
authored andcommitted
Fix: search openstack-operator-index in all namespaces
Currently it is looking for it in openstack-operator-index, but it is configured by default in openshift-marketplace. Task will look for it in any namespace
1 parent d2e1f18 commit a7af7d8

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

roles/env_op_images/tasks/main.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@
7777
ansible.builtin.set_fact:
7878
cifmw_openstack_service_images_content: "{{ _sa_images_content.stdout | from_json }}"
7979

80+
- name: Get all pods from all namespaces to find openstack-operator-index
81+
kubernetes.core.k8s_info:
82+
kind: Pod
83+
api_version: v1
84+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
85+
api_key: "{{ cifmw_openshift_token | default(omit)}}"
86+
context: "{{ cifmw_openshift_context | default(omit)}}"
87+
field_selectors:
88+
- status.phase=Running
89+
register: all_pods_list
90+
91+
- name: Retrieve openstack-operator-index pod
92+
vars:
93+
selected_pod: "{{ all_pods_list.resources | selectattr('metadata.generateName', 'defined') | selectattr('metadata.generateName', 'search', 'openstack-operator-index-') | list | first }}"
94+
ansible.builtin.set_fact:
95+
cifmw_install_yamls_vars_content:
96+
OPENSTACK_IMG: "{{ selected_pod.status.containerStatuses[0].imageID }}"
97+
8098
- name: Get all the pods in openstack-operator namespace
8199
vars:
82100
csv_items: "{{ (_csvs_out.stdout | from_yaml)['items'] }}"
@@ -94,13 +112,6 @@
94112
- status.phase=Running
95113
register: pod_list
96114

97-
- name: Retrieve openstack-operator-index pod
98-
vars:
99-
selected_pod: "{{ pod_list.resources| selectattr('metadata.generateName', 'equalto', 'openstack-operator-index-') | list | first }}"
100-
ansible.builtin.set_fact:
101-
cifmw_install_yamls_vars_content:
102-
OPENSTACK_IMG: "{{ selected_pod.status.containerStatuses[0].imageID }}"
103-
104115
- name: Get operator images and pods
105116
when: not cifmw_env_op_images_dryrun | bool
106117
vars:

0 commit comments

Comments
 (0)