Skip to content

Fixes to datacenter cache server strategy#251

Draft
agonzalezrh wants to merge 2 commits intomainfrom
fix-dc-mirror-strategy
Draft

Fixes to datacenter cache server strategy#251
agonzalezrh wants to merge 2 commits intomainfrom
fix-dc-mirror-strategy

Conversation

@agonzalezrh
Copy link
Copy Markdown
Collaborator

@agonzalezrh agonzalezrh commented Apr 15, 2026

Summary by CodeRabbit

  • Chores
    • Enhanced registry configuration flexibility for disconnected Quay environments with improved pattern matching.
    • Optimized plugin operator collection timing in the mirroring workflow for improved execution order.

@github-actions github-actions Bot added the operators Operator installation/config label Apr 15, 2026
@github-actions github-actions Bot added the deployment Deployment-related changes label Apr 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Walkthrough

Two Ansible automation files were modified: one updated a registry replacement pattern to use a configurable cache address with fallback, and the other reorganized mirror playbook task execution order to include plugin-operator collection earlier with expanded tag scope.

Changes

Cohort / File(s) Summary
Registry Configuration
operators/quay-operator/quay_disconnected.yaml
Updated the registry replacement pattern to match catalog: {{ dc_cache_address | default("registry.redhat.io") }} instead of a literal value, enabling dynamic cache address substitution while maintaining the same replacement target.
Playbook Task Organization
playbooks/02-mirror.yaml
Relocated the collect_core_plugin_operators task earlier in Phase 2 execution (before the mirror-cache task) and expanded its applied tags from mirror-registry + mirror-plugins to include mirror-cache. Removed the subsequent duplicate task inclusion with narrower tag scope.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fixes to datacenter cache server strategy' is directly related to the main changes: updating the quay-operator configuration to use dc_cache_address and adjusting the mirror playbook's task execution flow to support datacenter caching strategy.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-dc-mirror-strategy

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@operators/quay-operator/quay_disconnected.yaml`:
- Line 17: The regexp under the key "regexp" currently only matches "catalog:
<host>" and should be changed to match the full catalog path and version and to
escape any regex metacharacters in dc_cache_address; update the "regexp" value
so it (1) matches "catalog:" followed by optional whitespace, (2) inserts the
dc_cache_address (defaulting to "registry.redhat.io") with regex metacharacters
escaped, and (3) allows a slash and the rest of the image path and tag (e.g.,
/redhat/redhat-operator-index:v4.20) by matching the remainder non-greedily;
reference the regexp key and the dc_cache_address variable in
quay_disconnected.yaml when making this change.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e31151d8-bf96-437d-9284-5cf47bea86e6

📥 Commits

Reviewing files that changed from the base of the PR and between 49b9f64 and 948a90a.

📒 Files selected for processing (2)
  • operators/quay-operator/quay_disconnected.yaml
  • playbooks/02-mirror.yaml

ansible.builtin.replace:
path: "{{ workingDir }}/config/imagesetconfiguration.internal.yaml"
regexp: 'catalog: registry.redhat.io'
regexp: 'catalog: {{ dc_cache_address | default("registry.redhat.io") }}'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify which source host is used for catalog lines and whether Line 17 can miss matches.

set -euo pipefail

echo "== Where rh_operator_catalog/dc_cache_address are defined or overridden =="
rg -n -C2 '\brh_operator_catalog\b|\bdc_cache_address\b'

echo
echo "== Catalog rendering source in template =="
rg -n -C2 'catalog:|rh_operator_catalog|_core_plugin_operators' templates/imagesetconfiguration.yaml.j2

echo
echo "== Current replacement task context =="
rg -n -C2 'Replace registry.redhat.io with internal quay|ansible.builtin.replace|regexp:' operators/quay-operator/quay_disconnected.yaml

Repository: rh-ecosystem-edge/enclave

Length of output: 5414


Fix incomplete regex pattern that won't match rendered catalog content.

The regex on line 17 expects catalog: registry.redhat.io (or catalog: <dc_cache_address>), but the generated imagesetconfiguration.internal.yaml contains the full catalog path and version: catalog: registry.redhat.io/redhat/redhat-operator-index:v4.20. This mismatch causes the replacement to fail silently.

Additionally, if dc_cache_address contains regex metacharacters (e.g., dots in hostnames), they must be escaped in the pattern.

Suggested fix
-    regexp: 'catalog: {{ dc_cache_address | default("registry.redhat.io") }}'
+    regexp: 'catalog:\s+({{ dc_cache_address | default("registry.redhat.io", true) | regex_escape }}/.*|registry\.redhat\.io.*)'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
regexp: 'catalog: {{ dc_cache_address | default("registry.redhat.io") }}'
regexp: 'catalog:\s+({{ dc_cache_address | default("registry.redhat.io", true) | regex_escape }}/.*|registry\.redhat\.io.*)'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@operators/quay-operator/quay_disconnected.yaml` at line 17, The regexp under
the key "regexp" currently only matches "catalog: <host>" and should be changed
to match the full catalog path and version and to escape any regex
metacharacters in dc_cache_address; update the "regexp" value so it (1) matches
"catalog:" followed by optional whitespace, (2) inserts the dc_cache_address
(defaulting to "registry.redhat.io") with regex metacharacters escaped, and (3)
allows a slash and the rest of the image path and tag (e.g.,
/redhat/redhat-operator-index:v4.20) by matching the remainder non-greedily;
reference the regexp key and the dc_cache_address variable in
quay_disconnected.yaml when making this change.

@agonzalezrh agonzalezrh marked this pull request as draft April 15, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployment Deployment-related changes operators Operator installation/config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant