Use default_operator_source to configure MultiClusterHub#491
Conversation
WalkthroughIn ChangesMCE Subscription Source Parameterization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
this will fail when being called from sync. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@operators/advanced-cluster-management/configure_mch.yaml`:
- Line 11: The `default_operator_source` variable referenced in the template at
line 11 of the configure_mch.yaml file is not available in the task's scope,
causing the MCE subscription spec to fail in disconnected deployments. Fix this
by either: (1) computing the value locally in configure_mch.yaml using the
pattern `"cs-{{ mirror_rh_operator_catalog }}-v4-20"` where
mirror_rh_operator_catalog is available from defaults/catalogs.yaml, or (2)
explicitly passing default_operator_source through a `vars:` parameter in the
`include_tasks` call from 06-day2.yaml that includes this task. Choose the
approach that best fits your deployment pattern—option 1 keeps the logic
self-contained, while option 2 makes the dependency explicit at the call site.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: fad49a47-8520-43a4-bb1d-c5bc95c70369
📒 Files selected for processing (1)
operators/advanced-cluster-management/configure_mch.yaml
| mce_subscription_spec: | ||
| installPlanApproval: Manual | ||
| source: cs-mirror-redhat-operators-v4-20 | ||
| source: "{{ default_operator_source }}" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify that default_operator_source is defined before configure_mch.yaml is called
# Check if default_operator_source is set in load-vars.yaml
echo "=== Checking load-vars.yaml for default_operator_source ==="
rg -A 20 'load-vars.yaml' playbooks/06-day2.yaml
rg -n 'default_operator_source' playbooks/common/load-vars.yaml playbooks/defaults/* config/* 2>/dev/null || echo "Not found in common load files"
# Check all include_tasks calls to configure_mch.yaml
echo -e "\n=== All callers of configure_mch.yaml ==="
rg -B 2 -A 2 'configure_mch.yaml' --type=yaml
# Check where default_operator_source is set
echo -e "\n=== Where default_operator_source is defined ==="
rg -n 'default_operator_source:' --type=yamlRepository: rh-ecosystem-edge/enclave
Length of output: 1990
🏁 Script executed:
# Check the full context of 06-day2.yaml to see if default_operator_source is defined at play level
head -100 playbooks/06-day2.yaml | cat -n
# View configure_mch.yaml around line 11 with more context
echo "=== configure_mch.yaml (lines 1-20) ===" && head -20 operators/advanced-cluster-management/configure_mch.yaml | cat -n
# Check if default_operator_source is referenced anywhere else in configure_mch.yaml
echo -e "\n=== All references to default_operator_source in configure_mch.yaml ===" && rg -n 'default_operator_source' operators/advanced-cluster-management/configure_mch.yaml
# Check if default_operator_source is ever used as a play-level variable
echo -e "\n=== Play-level variable definitions in 06-day2.yaml ===" && rg -B 5 -A 5 '^\s*vars:' playbooks/06-day2.yaml | head -40Repository: rh-ecosystem-edge/enclave
Length of output: 6044
🏁 Script executed:
# View the actual contents of load-vars.yaml
echo "=== playbooks/common/load-vars.yaml ===" && cat playbooks/common/load-vars.yaml
# Check if there's inventory or group_vars that might define default_operator_source
echo -e "\n=== Checking for inventory or group_vars ===" && find . -name 'group_vars' -o -name 'host_vars' -o -name 'inventory*' | head -20
# Check if the playbook even runs or if variable is conditionally used
echo -e "\n=== Full configure_mch.yaml to understand variable usage ===" && cat operators/advanced-cluster-management/configure_mch.yamlRepository: rh-ecosystem-edge/enclave
Length of output: 4749
🏁 Script executed:
# Check the defaults files that are loaded, specifically operators.yaml and catalogs.yaml
echo "=== defaults/operators.yaml ===" && cat defaults/operators.yaml
echo -e "\n=== defaults/catalogs.yaml ===" && cat defaults/catalogs.yaml
# Also search for where mirror_rh_operator_catalog is defined (used in configure_operators.yaml)
echo -e "\n=== Searching for mirror_rh_operator_catalog definition ===" && rg -n 'mirror_rh_operator_catalog' defaults/Repository: rh-ecosystem-edge/enclave
Length of output: 3227
Critical: Undefined variable reference — default_operator_source is not available in this task's scope.
Line 11 uses {{ default_operator_source }}, but this variable is neither defined at the play level in 06-day2.yaml nor passed through the include_tasks call (line 35 includes no vars: parameter). The variable is only locally scoped in playbooks/tasks/configure_operators.yaml and playbooks/tasks/deploy_plugin.yaml.
Since this task executes only when disconnected | default(true) is true (line 7), rendering will fail or produce an empty string, breaking the MCE subscription spec configuration.
Risk: Runtime failure or incorrect catalog source configuration in disconnected deployments.
Suggested fix: Compute default_operator_source locally using the available mirror_rh_operator_catalog variable from defaults/catalogs.yaml (follow the pattern: "cs-{{ mirror_rh_operator_catalog }}-v4-20"), or pass it explicitly via vars: in the include_tasks call from 06-day2.yaml.
🤖 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 `@operators/advanced-cluster-management/configure_mch.yaml` at line 11, The
`default_operator_source` variable referenced in the template at line 11 of the
configure_mch.yaml file is not available in the task's scope, causing the MCE
subscription spec to fail in disconnected deployments. Fix this by either: (1)
computing the value locally in configure_mch.yaml using the pattern `"cs-{{
mirror_rh_operator_catalog }}-v4-20"` where mirror_rh_operator_catalog is
available from defaults/catalogs.yaml, or (2) explicitly passing
default_operator_source through a `vars:` parameter in the `include_tasks` call
from 06-day2.yaml that includes this task. Choose the approach that best fits
your deployment pattern—option 1 keeps the logic self-contained, while option 2
makes the dependency explicit at the call site.
Summary
Replace hardcoded catalog source name with the
default_operator_sourcevariable in MCE subscription configuration.Context
Follow-up to #488 (Extract MultiClusterHub configuration to reusable task).
Changes
cs-mirror-redhat-operators-v4-20to{{ default_operator_source }}Benefits
default_operator_source-v4-20suffix)Testing
Summary by CodeRabbit
Release Notes