Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openshift_setup] Add support for overriding dependent operators CatalogSource #2694

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ bootmode
buildah
buildpkgs
cacheable
catalogsource
cci
ccitredhat
ceilometer
Expand Down
10 changes: 6 additions & 4 deletions docs/source/usage/01_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ are shared among multiple roles:
- `cifmw_deploy_edpm`: (Bool) toggle deploying EDPM. Default to false.
- `cifmw_use_vbmc`: (Bool) Toggle VirtualBMC usage. Defaults to `false`.
- `cifmw_use_sushy_emulator`: (Bool) Toggle Sushy Emulator usage. Defaults to `true`.
- `cifmw_set_openstack_containers`: (Bool) Run set_openstack_containers role during deployment to update openstack containers. Defaults to `false`.
- `cifmw_set_openstack_containers`: (Bool) Run set_openstack_containers role during deployment to update openstack containers. Defaults to `false`.
- `cifmw_sushy_redfish_bmc_protocol`: (String) The RedFish BMC protocol you would like to use with Sushy Emulator, options are `redfish` or `redfish-virtualmedia`. Defaults to `redfish-virtualmedia`
- `cifmw_config_nmstate`: (Bool) toggle NMstate networking deployment. Default to false.
- `cifmw_config_multus`: (Bool) toggle Multus networking deployment. Default to false.
Expand All @@ -57,7 +57,7 @@ are shared among multiple roles:
- `cifmw_edpm_deploy_nfs`: (Bool) Specifies whether an nfs server should be deployed.
- `cifmw_nfs_target`: (String) The Ansible inventory group where the nfs server is deployed. Defaults to `computes`. Only has an effect if `cifmw_edpm_deploy_nfs` is set to `true`.
- `cifmw_nfs_network`: (String) The network the deployed nfs server will be accessible from. Defaults to `storage`. Only has an effect if `cifmw_edpm_deploy_nfs` is set to `true`.
- `cifmw_nfs_shares`: (List) List of the shares that will be setup in the nfs server. Only has an effect if `cifmw_edpm_deploy_nfs` is set to `true`.
- `cifmw_nfs_shares`: (List) List of the shares that will be setup in the nfs server. Only has an effect if `cifmw_edpm_deploy_nfs` is set to `true`.
- `cifmw_fips_enabled`: (Bool) Specifies whether FIPS should be enabled in the deployment. Note that not all deployment methods support this functionality. Defaults to `false`.
- `cifmw_baremetal_hosts`: (Dict) Baremetal nodes environment details. More details [here](../baremetal/01_baremetal_hosts_data.md)
- `cifmw_deploy_obs` (Bool) Specifies whether to deploy Cluster Observability operator.
Expand All @@ -67,12 +67,13 @@ are shared among multiple roles:
- `cifmw_parent_scenario`: (String or List(String)) path to existing scenario/parameter file to inherit from.
- `cifmw_configure_switches`: (Bool) Specifies whether switches should be configured. Computes in `reproducer.yml` playbook. Defaults to `false`.
- `cifmw_use_ocp_overlay`: (Boolean) Specifies whether OCP nodes deployed via devscripts should use overlay images. Using overlay images speeds up the redeployment when using the reproducer role locally but in CI each job is cleaned up and redeployed. Creating the overlay image takes time so should be disabled when not used. Defaults to `true`.
- `cifmw_run_operators_compliance_scans`: (Bool) Specifies whether to run operator compliance scans. Defaults to `false`.
- `cifmw_run_compute_compliance_scans`: (Bool) Specifies whether to run compliance scans on the first compute. Defaults to `false`.
- `cifmw_run_operators_compliance_scans`: (Bool) Specifies whether to run operator compliance scans. Defaults to `false`.
- `cifmw_run_compute_compliance_scans`: (Bool) Specifies whether to run compliance scans on the first compute. Defaults to `false`.
- `cifmw_run_id`: (String) CI Framework run identifier. This is used in libvirt_manager, to add some uniqueness to some types of virtual machines (anything that's not OCP, CRC nor controller).
If not set, the Framework will generate a random string for you, and store it on the target host, in `{{ cifmw_basedir }}/artifacts/run-id`
- `cifmw_deploy_architecture_args`: (String) additional args and parameters to pass to the deploy-architecture script. Default is `''`.
- `cifmw_enable_virtual_baremetal_support`: (Bool) Toggle the deployment and configuration of virtual baremetal services. If enabled Sushy Emulator will be deployed to OCP and Libvirt will be configured on the CI-Framework Ansible controller node. Defaults to `false`
- `cifmw_openshift_setup_enable_operator_catalog_override`: (Bool) Toggles the option to deploy a custom CatalogSource and patch dependent operators to use it. Defaults to `false`

```{admonition} Words of caution
:class: danger
Expand Down Expand Up @@ -101,6 +102,7 @@ proper parameter name, you may run arbitrary playbook or load custom CRDs at
specific points in the standard run.

Hooks may be presented in two ways:

- as a list
- as a single hook in a parameter

Expand Down
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 |
lewisdenny marked this conversation as resolved.
Show resolved Hide resolved
default(false) | bool
ansible.builtin.import_role:
name: openshift_setup
tasks_from: patch_dependent_operators_source.yml

pablintino marked this conversation as resolved.
Show resolved Hide resolved
- 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"
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
lewisdenny marked this conversation as resolved.
Show resolved Hide resolved
# by intalling the previous OCP release's catalog source for the
# dependent operators to use and overriding their 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
lewisdenny marked this conversation as resolved.
Show resolved Hide resolved
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"