123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- ---
- - name: Wait for the marketplace-operator to be up
- k8s_info:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: v1
- kind: pod
- namespace: openshift-marketplace
- label_selectors:
- - name=marketplace-operator
- register: mktplc_pod
- until:
- - (mktplc_pod.resources | length) == 1
- - mktplc_pod.resources[0].status.containerStatuses[0].ready
- retries: 30
- delay: 10
- - name: Get info about the SSO catalog secret
- k8s_info:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: v1
- kind: secret
- namespace: openshift-marketplace
- name: catalogsecret
- register: sso_sec
- - name: Get rid of the secret if anything is wrong with it
- k8s:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- state: absent
- api_version: v1
- kind: secret
- namespace: openshift-marketplace
- name: catalogsecret
- register: sso_sec_removed
- when:
- - sso_sec.resources is defined
- - (sso_sec.resources | length) == 1
- - |-
- (sso_sec.resources[0].data[".dockerconfigjson"] is not defined) or
- (sso_sec.resources[0].type != "kubernetes.io/dockerconfigjson")
- - name: Create a secret to access the catalog image if not yet there
-
-
-
-
-
-
-
-
-
-
-
-
- command: oc --kubeconfig=tmp/kubeconfig-ocp4 -n openshift-marketplace create secret docker-registry catalogsecret --docker-server=quay.io --docker-username={{ robot_username }} --docker-password={{ robot_token }}
- when: |-
- sso_sec_removed.changed or
- (sso_sec.resources is not defined) or
- ((sso_sec.resources | length) == 0) or
- (sso_sec.resources[0].data[".dockerconfigjson"] is not defined)
- - name: Get info about the rhsso-operator
- k8s_info:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: packages.operators.coreos.com/v1
- kind: packagemanifest
- namespace: openshift-marketplace
- name: rhsso-operator
- register: sso_mft
- - name: Remove existing catalogsource from openshift-marketplace if rhsso-operator belongs to it
- k8s:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: operators.coreos.com/v1alpha1
- kind: catalogsource
- namespace: openshift-marketplace
- name: do280-catalog
- state: absent
- when:
- - sso_mft.resources is defined
- - (sso_mft.resources | length) > 0
- - sso_mft.resources[0].status.catalogSource == "do280-catalog"
- - name: Make certain the "standard" catalog source is updated
- k8s:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: operators.coreos.com/v1alpha1
- kind: catalogsource
- namespace: openshift-marketplace
- name: do280-catalog
- state: present
- definition:
- spec:
- displayName: "do280 Operator Catalog"
- image: "quay.io/rhtuser/do280-catalog-nosso:v4.10"
- publisher: "Red Hat"
- secrets:
- - "catalogsecret"
- sourceType: "grpc"
- - name: Ensure the RHSSO catalog source is there as well
- k8s:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: operators.coreos.com/v1alpha1
- kind: catalogsource
- namespace: openshift-marketplace
- name: do280-sso
- state: present
- definition:
- spec:
- displayName: "do280 SSO Catalog"
- image: "quay.io/rhtuser/do280-sso-operator:v4.10"
- publisher: "Red Hat"
- secrets:
- - "catalogsecret"
- sourceType: "grpc"
- - name: Wait for the catalogsource to be ready.
- k8s_info:
- kubeconfig: tmp/kubeconfig-ocp4
- validate_certs: no
- api_version: operators.coreos.com/v1alpha1
- kind: catalogsource
- namespace: openshift-marketplace
- name: do280-sso
- register: sso_cat
- until:
- - (sso_cat.resources | length) == 1
- - sso_cat.resources[0].status is defined
- - sso_cat.resources[0].status.connectionState.lastObservedState == "READY"
- retries: 30
- delay: 10
- - name: Wait for the rhsso-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: rhsso-operator
- register: sso_mft
- until:
- - (sso_mft.resources | length) == 1
- - sso_mft.resources[0].status.catalogSource == "do280-sso"
- - sso_mft.resources[0].status.packageName == "rhsso-operator"
- retries: 30
- delay: 10
- - assert:
- that:
- - sso_mft.resources is defined
- - (sso_mft.resources | length) > 0
- - sso_mft.resources[0].status.catalogSource == "do280-sso"
- - '"rhsso-operator.7.6.0-opr-003" in (sso_mft.resources[0] | community.general.json_query("status.channels[*].currentCSV") | list)'
- fail_msg: "ERROR: rhsso-operator package manifest not deployed correctly."
- success_msg: "OK: rhsso-operator package manifest configured correctly."
- ...
|