feat: Add custom CatalogSource support and per-operator catalog overr…#824
Conversation
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (17)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (13)
📝 WalkthroughWalkthroughAdds per-operator catalogsource defaults, templates to render optional custom OpenShift CatalogSource manifests, task wiring to create/apply them when provided, Subscription template conditionals using operator-specific catalogsource variables, and new documentation with a README link. ChangesCustom CatalogSources Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/test ? |
|
/test deploy-mno |
|
/test deploy-sno |
|
/lgtm |
271a2b4 to
5490cbf
Compare
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
/test deploy-mno |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/custom-catalogsources.md (1)
132-148:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winClose the YAML code block to avoid broken Markdown rendering.
The second example block appears to be missing a closing triple-backtick fence after Line 147, which can break formatting for the rest of the page. Add a closing ``` on Line 148.
As per coding guidelines, "
docs/**: Documentation files. Check for: ... Consistent formatting with existing documentation."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/custom-catalogsources.md` around lines 132 - 148, The YAML example block under custom_catalogsources (showing entries like odf-staging and gitops-nightly and the odf_catalogsource/gitops_catalogsource settings) is missing its closing triple-backtick fence which breaks Markdown rendering; fix by adding a closing ``` after the YAML example so the fenced code block is properly terminated and the rest of docs render correctly.
🧹 Nitpick comments (2)
ansible/roles/sno-post-cluster-install/tasks/main.yml (1)
119-122: ⚡ Quick winConsider using
kubernetes.core.k8smodule instead of shell for applying CatalogSources.The
kubernetes.corecollection is not currently available in this project's dependencies. To use the native k8s module, addkubernetes.coreto arequirements.ymlor declare it as a collection dependency. This refactor is worth considering as part of broader work to replaceshell: oc applypatterns throughout the role with native Ansible modules, but it requires upfront dependency management setup.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ansible/roles/sno-post-cluster-install/tasks/main.yml` around lines 119 - 122, Replace the shell task named "Apply custom CatalogSources" that runs "KUBECONFIG=... oc apply -f .../catalogsource.yml" with the kubernetes.core.k8s module: add the kubernetes.core collection to project dependencies (requirements.yml or collections in meta/main.yml), then use the k8s module pointing at the kubeconfig (kubeconfig: "{{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig") and load the manifest file (definition: lookup('file', '{{ bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/catalogsources/catalogsource.yml') or use src parameter) with state: present; keep the existing when: custom_catalogsources | length > 0. Ensure the task references the same variables (bastion_cluster_config_dir, groups['sno'][0], custom_catalogsources) and remove the shell/oc use.ansible/roles/mno-post-cluster-install/tasks/main.yml (1)
141-144: ⚡ Quick winAdd kubernetes.core collection dependency before refactoring to kubernetes.core.k8s module.
Using
kubernetes.core.k8simproves idempotency and error handling overshell, but the collection is not currently declared in the project. First addkubernetes.coreto arequirements.ymlfile (or equivalent collection requirements), then migrate this task and the other 25+ similar shell/oc tasks in the role.♻️ Suggested change (requires collection prerequisite)
- name: Apply custom CatalogSources - shell: | - KUBECONFIG={{ bastion_cluster_config_dir }}/kubeconfig oc apply -f {{ bastion_cluster_config_dir }}/catalogsources/catalogsource.yml + kubernetes.core.k8s: + kubeconfig: "{{ bastion_cluster_config_dir }}/kubeconfig" + state: present + src: "{{ bastion_cluster_config_dir }}/catalogsources/catalogsource.yml" when: custom_catalogsources | length > 0Note: This pattern affects many tasks throughout the role (oc apply, oc create, oc patch, oc label, etc.). Consider a broader refactoring strategy once the collection dependency is in place.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ansible/roles/mno-post-cluster-install/tasks/main.yml` around lines 141 - 144, Add the kubernetes.core collection to the project's collection requirements (e.g., add "kubernetes.core" to requirements.yml) before refactoring shell-based oc calls; then replace the "Apply custom CatalogSources" shell task (the task named "Apply custom CatalogSources" that runs "KUBECONFIG={{ bastion_cluster_config_dir }}/kubeconfig oc apply -f {{ bastion_cluster_config_dir }}/catalogsources/catalogsource.yml") with the kubernetes.core.k8s module using the kubeconfig parameter and the appropriate definition/file argument to ensure idempotency and error handling, and apply the same migration pattern to the other ~25 shell/oc tasks (oc apply/create/patch/label) in the role.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@ansible/roles/sno-post-cluster-install/templates/performance-addon-operator.yml.j2`:
- Around line 23-27: In performance-addon-operator.yml.j2, when the conditional
branch checks use_bastion_registry and pao_catalogsource == 'redhat-operators',
replace the reference to operator_index_name with
generated_operator_index_name_tag so the spec.source uses the same bastion
registry tag variable as other operator templates; keep the conditional logic
(use_bastion_registry and pao_catalogsource) unchanged and only swap the
variable name to generated_operator_index_name_tag.
---
Outside diff comments:
In `@docs/custom-catalogsources.md`:
- Around line 132-148: The YAML example block under custom_catalogsources
(showing entries like odf-staging and gitops-nightly and the
odf_catalogsource/gitops_catalogsource settings) is missing its closing
triple-backtick fence which breaks Markdown rendering; fix by adding a closing
``` after the YAML example so the fenced code block is properly terminated and
the rest of docs render correctly.
---
Nitpick comments:
In `@ansible/roles/mno-post-cluster-install/tasks/main.yml`:
- Around line 141-144: Add the kubernetes.core collection to the project's
collection requirements (e.g., add "kubernetes.core" to requirements.yml) before
refactoring shell-based oc calls; then replace the "Apply custom CatalogSources"
shell task (the task named "Apply custom CatalogSources" that runs
"KUBECONFIG={{ bastion_cluster_config_dir }}/kubeconfig oc apply -f {{
bastion_cluster_config_dir }}/catalogsources/catalogsource.yml") with the
kubernetes.core.k8s module using the kubeconfig parameter and the appropriate
definition/file argument to ensure idempotency and error handling, and apply the
same migration pattern to the other ~25 shell/oc tasks (oc
apply/create/patch/label) in the role.
In `@ansible/roles/sno-post-cluster-install/tasks/main.yml`:
- Around line 119-122: Replace the shell task named "Apply custom
CatalogSources" that runs "KUBECONFIG=... oc apply -f .../catalogsource.yml"
with the kubernetes.core.k8s module: add the kubernetes.core collection to
project dependencies (requirements.yml or collections in meta/main.yml), then
use the k8s module pointing at the kubeconfig (kubeconfig: "{{
bastion_cluster_config_dir }}/{{ groups['sno'][0] }}/kubeconfig") and load the
manifest file (definition: lookup('file', '{{ bastion_cluster_config_dir }}/{{
groups['sno'][0] }}/catalogsources/catalogsource.yml') or use src parameter)
with state: present; keep the existing when: custom_catalogsources | length > 0.
Ensure the task references the same variables (bastion_cluster_config_dir,
groups['sno'][0], custom_catalogsources) and remove the shell/oc use.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: eb656161-38ea-454e-b684-38f34e6c84e8
📒 Files selected for processing (17)
README.mdansible/roles/mno-post-cluster-install/defaults/main/main.ymlansible/roles/mno-post-cluster-install/defaults/main/odf.ymlansible/roles/mno-post-cluster-install/tasks/main.ymlansible/roles/mno-post-cluster-install/templates/ansible-automation-platform-operator.yml.j2ansible/roles/mno-post-cluster-install/templates/catalogsource.yml.j2ansible/roles/mno-post-cluster-install/templates/localstorage.yml.j2ansible/roles/mno-post-cluster-install/templates/odf.yml.j2ansible/roles/mno-post-cluster-install/templates/openshift-gitops-operator.yml.j2ansible/roles/mno-post-cluster-install/templates/performance-addon-operator.yml.j2ansible/roles/sno-post-cluster-install/defaults/main/main.ymlansible/roles/sno-post-cluster-install/tasks/main.ymlansible/roles/sno-post-cluster-install/templates/catalogsource.yml.j2ansible/roles/sno-post-cluster-install/templates/localstorage.yml.j2ansible/roles/sno-post-cluster-install/templates/openshift-gitops-operator.yml.j2ansible/roles/sno-post-cluster-install/templates/performance-addon-operator.yml.j2docs/custom-catalogsources.md
…ides Allow custom CatalogSource resources to be applied post-install and enable each operator to use a different catalog source via override variables. This supports installing operators from custom or third-party operator indexes alongside or instead of the default redhat-operators. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5490cbf to
5e037e6
Compare
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mcornea The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
8bbca33
into
redhat-performance:main
…ides
Allow custom CatalogSource resources to be applied post-install and enable each operator to use a different catalog source via override variables. This supports installing operators from custom or third-party operator indexes alongside or instead of the default redhat-operators.
Summary by CodeRabbit
New Features
Behavior
Documentation