Sfoglia il codice sorgente

separated vars from deploy-operators role, just need a csv for verification

Grega Bremec 7 mesi fa
parent
commit
a2bbee705f
1 ha cambiato i file con 36 aggiunte e 28 eliminazioni
  1. 36 28
      playbooks/roles/fix-operators/tasks/main.yml

+ 36 - 28
playbooks/roles/fix-operators/tasks/main.yml

@@ -6,12 +6,13 @@
 #   removed_sources the catalog sources we remove
 #   catalog_sources the catalog sources we recreate
 #
-# These should come from inventory:
+# These would usually come from inventory, and should point to a single
+# manifest and its CSV that we can use to verify catalog sources were created
+# and populated successfully:
 #
-#   op_cat          catalog source
-#   op_pkg          operator package name
-#   op_chn          operator channel
-#   desired_csv     csv we look for
+#   vrfy_cat     catalog source
+#   vrfy_pkg     operator package name
+#   vrfy_csv     csv we look for
 #
 # This is necessary immediately after lab create.
 - name: Wait for the marketplace-operator to be up
@@ -90,28 +91,35 @@
   loop_control:
     label: "{{ item.displ }}"
 
-- name: Wait for the operator packagemanifest to appear.
-  k8s_info:
-    kubeconfig: tmp/kubeconfig-ocp4
-    validate_certs: no
-    api_version: packages.operators.coreos.com/v1
-    kind: packagemanifest
-    namespace: openshift-marketplace
-    name: "{{ op_pkg }}"
-  register: op_mft
-  until:
-    - (op_mft.resources | length) == 1
-    - op_mft.resources[0].status.catalogSource == op_cat
-    - op_mft.resources[0].status.packageName == op_pkg
-  retries: 60
-  delay: 10
+- name: Verify correct deployment
+  block:
+    - name: Wait for the operator packagemanifest to appear.
+      k8s_info:
+        kubeconfig: tmp/kubeconfig-ocp4
+        validate_certs: no
+        api_version: packages.operators.coreos.com/v1
+        kind: packagemanifest
+        namespace: openshift-marketplace
+        name: "{{ vrfy_pkg }}"
+      register: vrfy_mft
+      until:
+        - (vrfy_mft.resources | length) == 1
+        - vrfy_mft.resources[0].status.catalogSource == vrfy_cat
+        - vrfy_mft.resources[0].status.packageName == vrfy_pkg
+      retries: 60
+      delay: 10
+
+    - assert:
+        that:
+          - vrfy_mft.resources is defined
+          - (vrfy_mft.resources | length) > 0
+          - vrfy_mft.resources[0].status.catalogSource == vrfy_cat
+          - 'vrfy_csv in (vrfy_mft.resources[0] | community.general.json_query("status.channels[*].currentCSV") | list)'
+        fail_msg: "ERROR: {{ vrfy_pkg }} package manifest not deployed correctly."
+        success_msg: "OK: {{ vrfy_pkg }} package manifest configured correctly."
 
-- assert:
-    that:
-      - op_mft.resources is defined
-      - (op_mft.resources | length) > 0
-      - op_mft.resources[0].status.catalogSource == op_cat
-      - 'desired_csv in (op_mft.resources[0] | community.general.json_query("status.channels[*].currentCSV") | list)'
-    fail_msg: "ERROR: {{ op_pkg }} package manifest not deployed correctly."
-    success_msg: "OK: {{ op_pkg }} package manifest configured correctly."
+  when:
+    - vrfy_cat is defined
+    - vrfy_pkg is defined
+    - vrfy_csv is defined
 ...