Skip to content

Commit

Permalink
[openshift_setup] Add support for overriding dependent operators Cata…
Browse files Browse the repository at this point in the history
…logSource
  • Loading branch information
lewisdenny committed Feb 4, 2025
1 parent 475d689 commit c281822
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roles/kustomize_deploy/tasks/install_operators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@
status: "True"
wait_timeout: 300

- name: Create catalog source and switch dependent operators to consume it
when:
- cifmw_openshift_setup_enable_operator_catalog_override |
default(false) | bool
ansible.builtin.import_role:
name: openshift_setup
tasks_from: patch_dependent_operators_source.yml

- name: Wait for controller-manager pods
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
Expand All @@ -198,6 +206,7 @@
type: Ready
status: "True"
wait_timeout: 300

- name: Wait for webhook-server pods
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
Expand Down
3 changes: 3 additions & 0 deletions roles/openshift_setup/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ cifmw_openshift_setup_skip_internal_registry_tls_verify: false
cifmw_openshift_setup_ca_bundle_path: "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
cifmw_openshift_setup_digest_mirrors: []
cifmw_openshift_setup_metal3_watch_all_ns: false
cifmw_openshift_setup_operator_override_catalog_name: "redhat-operators-4.17"
cifmw_openshift_setup_operator_override_catalog_namespace: "openshift-marketplace"
cifmw_openshift_setup_operator_override_catalog_image: "registry.redhat.io/redhat/redhat-operator-index:v4.17"
58 changes: 58 additions & 0 deletions roles/openshift_setup/tasks/patch_dependent_operators_source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# HACK: (Lewis) This taskfile is used to test pre-release OCP versions
# by intalling the previous OCP release's catalog source for the
# dependent operators to use and overriding there subscriptions

- name: Write catalog source
kubernetes.core.k8s:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
state: present
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: "{{ cifmw_openshift_setup_operator_override_catalog_name }}"
namespace: "{{ cifmw_openshift_setup_operator_override_catalog_namespace }}"
spec:
displayName: "{{ cifmw_openshift_setup_operator_override_catalog_name }}"
image: "{{ cifmw_openshift_setup_operator_override_catalog_image }}"
publisher: CI-Framework
sourceType: grpc
updateStrategy:
registryPoll:
interval: 10m

- name: Patch metallb operator subscription to use custom CatalogSource
kubernetes.core.k8s:
state: patched
kind: Subscription
api_version: operators.coreos.com/v1alpha1
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
name: metallb-operator-sub
namespace: metallb-system
definition:
spec:
source: "{{ cifmw_openshift_setup_operator_override_catalog_name }}"
wait: true
wait_timeout: 300
wait_condition:
type: CatalogSourcesUnhealthy
status: "False"

- name: Patch nmstate operator subscription to use custom CatalogSource
kubernetes.core.k8s:
state: patched
kind: Subscription
api_version: operators.coreos.com/v1alpha1
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
name: kubernetes-nmstate-operator
namespace: openshift-nmstate
definition:
spec:
source: "{{ cifmw_openshift_setup_operator_override_catalog_name }}"
wait_sleep: 10
wait: true
wait_timeout: 300
wait_condition:
type: CatalogSourcesUnhealthy
status: "False"

0 comments on commit c281822

Please sign in to comment.