Parcourir la source

fix the channel search process (dual names of pkg mft)

Grega Bremec il y a 7 mois
Parent
commit
59a234d330
1 fichiers modifiés avec 14 ajouts et 3 suppressions
  1. 14 3
      playbooks/roles/deploy-operator/tasks/main.yml

+ 14 - 3
playbooks/roles/deploy-operator/tasks/main.yml

@@ -50,15 +50,26 @@
   block:
 
     # Check if package provides desired_csv in any of the channels
-    - name: Get packagemanifest
+    # XXX Due to the idiotic fact that some operators from different catalogs
+    #     have the same manifest name, this needs to be a two-phase query.
+    # XXX First, query for all operators from the desired catalog.
+    - name: Get packagemanifests from same catalog
       k8s_info:
         kubeconfig: tmp/kubeconfig-ocp4
         validate_certs: no
         api_version: packages.operators.coreos.com/v1
         kind: packagemanifest
         namespace: openshift-marketplace
-        name: "{{ op.op_pkg }}"
-      register: pkg_mft
+        label_selectors:
+          - "catalog = {{ op.op_cat }}"
+      register: pkg_mft_samecat
+
+    # XXX Then, search for the operator that has the status.packageName we need.
+    - name: Weed out the manifest we need
+      set_fact:
+        pkg_mft: '{{ pkg_mft_samecat | community.general.json_query("resources[?status.packageName == `" + op.op_pkg + "`]") }}'
+
+    - debug: var=pkg_mft
 
     - name: Search for any channels that provide desired_csv
       set_fact: