Skip to content

Commit

Permalink
[cert_manager]Disable/Enable default catalogsource
Browse files Browse the repository at this point in the history
On crc Zuul reproducer job, cert-manager operator installation is
failing with following error.
```
the cert-manager CRDs are not yet installed on the Kubernetes API server
```

The cert-manager operator get installed from openshift marketplace.
After digging deep, we found that pods under openshift-marketplace
namespace are hitting CrashLoopBackOff due to following error.
```
failed to populate resolver cache from source redhat-operators/openshift-marketplace:
failed to list bundles: rpc error: code = Unavailable desc = connection error: desc =
```

Based on https://access.redhat.com/solutions/7052456, enabling and
disabling catalogsource fixes the issue.

Adding this a hook so that anyone can reuse it in pre_infra phase.

Signed-off-by: Chandan Kumar <[email protected]>
  • Loading branch information
raukadah committed Apr 16, 2024
1 parent 539cd79 commit 43267db
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
41 changes: 41 additions & 0 deletions hooks/playbooks/disable_catalogsource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
- name: Disable/Enable default CatalogSource
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
tasks:
- name: Get the pods having CrashLoopBackOff state
kubernetes.core.k8s_info:
kind: Pod
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
namespace: openshift-marketplace
field_selectors:
- status.phase=CrashLoopBackOff
register: _pod_status

- name: Disable/Enable CatalogSource
when: _pod_status.resources | length > 0
block:
- name: Disable default CatalogSource
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command: >-
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
- name: Enable default CatalogSource
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command: >-
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": false}]'
- name: Wait for openshift-marketplace pods to be running
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
kind: Pod
namespace: openshift-marketplace
wait: true
wait_condition:
type: Ready
status: "True"
wait_timeout: 300
6 changes: 6 additions & 0 deletions scenarios/centos-9/multinode-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ cifmw_use_libvirt: false

cifmw_openshift_setup_skip_internal_registry_tls_verify: true

pre_infra:
- name: Disable/Enable Red Hat marketplace catalogsource
type: playbook
inventory: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
source: disable_catalogsource.yml

post_infra:
- name: Fetch nodes facts and save them as parameters
type: playbook
Expand Down

0 comments on commit 43267db

Please sign in to comment.