Automated tools and AI-assisted analysis for comparing cloud credential policies and feature gates across OpenShift versions.
make setup # Install Python deps and pre-commit hook
make lint # Static checks (same target as Prow)
make test # Unit tests (tests/)This framework helps platform teams identify IAM permission and feature gate changes between OpenShift versions, ensuring proper cloud permissions are in place before upgrades.
The framework performs 13 validation checks across all scripts:
| Check # | Analysis Type | Description | Pass/Fail Impact |
|---|---|---|---|
| 1 | AWS STS Resources | Validates STS policy files in managed-cluster-config | Exit 1 on FAIL |
| 2 | AWS STS Admin Ack | Validates AWS acknowledgment files | Exit 1 on FAIL |
| 3 | GCP WIF Resources | Validates WIF template in managed-cluster-config | Exit 1 on FAIL |
| 4 | GCP WIF Admin Ack | Validates GCP acknowledgment files | Exit 1 on FAIL |
| 5 | OCP Admin Gates | Validates admin gate acknowledgments | Exit 1 on FAIL |
| 6 | Versions & Channels | Validates version availability in release channels and marketplaces | Exit 1 on FAIL |
| 7 | OCM Version Gates | Validates OCM version gate configurations | Exit 1 on FAIL |
| 8 | Feature Gates | Tracks feature gate changes (informational) | Always PASS |
| 9 | API Resources and CRD Diff Validation | Compares live ROSA API resources and CRDs (HCP, Classic, OSD GCP; OSD GCP skipped for 5.x) | Always PASS (SKIP if snapshots missing) |
| 10 | Critical Alerts Diff Validation | Compares live PrometheusRule alerts; recommends inherit / silence / review / not-applicable. Same topologies as Check #9. | Always PASS (SKIP if snapshots missing) |
| 11 | Cluster Install and Delete Validation | Compares live ClusterOperator/node install health (same topologies as Check #9). Delete-duration metrics are not in the snapshot yet. | Always PASS (SKIP if snapshots missing) |
| 12 | Target E2E Validation and alert monitoring | Target-version rosa-e2e JUnit (junit-rosa-e2e.xml). HCP, Classic, and OSD GCP. OSD GCP skipped for 5.x. Missing JUnit is SKIP. Failed tests are reported as FAIL in the report (current e2e quality) and do not fail the job. Alert monitoring SKIP until VerifyNoCriticalAlerts exists in rosa-e2e. |
Always PASS (SKIP if JUnit missing) |
| 13 | Upgrade Validation from Y-1 to Y with E2E Tests | Y-1 → Y upgrade path from rosa-e2e HCP, Classic, and OSD GCP upgrade periodics. Missing JUnit is SKIP. Failed post-upgrade e2e or unhealthy ClusterOperators FAIL. | Exit 1 on FAIL |
See Validation Checks for detailed information about each check.
- 🚀 Automated Analysis: Scripts handle data extraction and comparison
- 📊 Multi-Format Reports: Generate HTML and JSON reports automatically
- 🔄 Auto-Detection: Automatically detect latest stable and candidate versions
- 🤖 AI-Powered: Claude Code skills for intelligent analysis and recommendations
- ✅ CI/CD Ready: Exit codes designed for pipeline integration
- 📦 Container-Based: Pre-built container image for OpenShift CI (Prow)
- 🔗 PR Link Tracking: Automatic GitHub PR attribution for unexpected managed-cluster-config changes
pip install -r requirements.txt # or: make setup
# Download OpenShift CLI
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz | tar xz -C /usr/local/binSee Installation Guide for detailed setup. Optional: ocm, rosa (channel/marketplace/version gates), gh (PR link detection).
# Auto-detect versions (compares latest stable → latest candidate)
./scripts/gap-all.sh
# Single version auto-resolve (RECOMMENDED)
./scripts/gap-all.sh --version 4.21 # GA: z-stream (stable → stable)
./scripts/gap-all.sh --version 4.22 # Pre-GA: cross-minor (stable → candidate)
./scripts/gap-all.sh --version 4.23 # Other: cross-minor (candidate → candidate)
./scripts/gap-all.sh --version 5.0 # 5.x: 4.22 → 5.0 (special mapping)
./scripts/gap-all.sh --version 5.1 # 5.x: 4.23 → 5.1 (special mapping)
./scripts/gap-all.sh --version 5.2 # 5.x: 5.1 → 5.2 (normal progression)
OPENSHIFT_VERSION=4.22 ./scripts/gap-all.sh # Same as --version 4.22
# Explicit baseline and target (both required)
./scripts/gap-all.sh --baseline 4.21 --target 4.22
# Test against nightly builds
BASE_VERSION=4.21 TARGET_VERSION=NIGHTLY ./scripts/gap-all.sh
# Dry-run mode (show versions without running analysis)
./scripts/gap-all.sh --version 4.21 --dry-run
./scripts/gap-all.sh --dry-run # Show auto-detected versions
# Custom report directory
REPORT_DIR=/custom/reports ./scripts/gap-all.shReports are automatically generated in ./reports/ directory:
# Open HTML report in browser
firefox reports/gap-analysis-full_*.html
# Parse JSON report programmatically
jq '.aws_sts.comparison' reports/gap-analysis-full_*.jsonQuick curl commands to check current OpenShift versions from accepted release streams:
# Get latest GA version from Sippy. ga_dates lists every product Sippy tracks
# (logging-6.6 and friends), so select the OCP releases via release_attrs --
# sorting the raw key set feeds a non-version key to tonumber and fails.
# A release absent from release_attrs is treated as OCP, as the resolvers do;
# a product that is present is obeyed whatever its type, so `// "OCP"` must not
# be applied to the product value -- that would read `false` as "absent" too.
# The key test matches EXACTLY major.minor, as the resolvers do: a longer
# dotted-digit key such as 4.21.3 parses fine and would then sort in beside
# the minors, so `last` could hand back a version no caller can use.
# It ends at \z, not $: jq's regex engine lets $ match before a trailing
# newline, so "4.19\n" would reach tonumber and abort the command.
curl -s https://sippy.dptools.openshift.org/api/releases | \
jq -r '((.release_attrs | objects) // {}) as $a | .ga_dates | keys
| map(select(test("^[0-9]+[.][0-9]+\\z")))
| map(select((($a[.] | objects) // {} | .product) as $product
| $product == null or $product == "OCP"))
| sort_by(split(".") | map(tonumber)) | last'
# Get latest stable for GA line (e.g., 4.21.x)
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["4-stable"][] | select(startswith("4.21."))' | head -1
# Get latest RC candidate (e.g., 4.22.0-rc.*)
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["4-stable"][] | select(startswith("4.22.0-rc."))' | head -1
# Get latest EC candidate (e.g., 4.22.0-ec.*)
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["4-dev-preview"][] | select(startswith("4.22.0-ec."))' | head -1
# All accepted 4-stable versions
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["4-stable"][]'
# Get latest 5.0 stable z-stream (5.x lives in 5-stable, not 4-stable;
# X-stable also carries that major's RC builds, so exclude them)
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["5-stable"][] | select(startswith("5.0.") and ((contains("-rc.") or contains("-ec.")) | not))' | head -1
# Get latest 5.0 RC candidate
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["5-stable"][] | select(startswith("5.0.0-rc."))' | head -1
# Get latest 5.1 RC candidate
curl -s https://amd64.ocp.releases.ci.openshift.org/api/v1/releasestreams/accepted | \
jq -r '.["5-stable"][] | select(startswith("5.1.0-rc."))' | head -1Note: These queries return only accepted builds that have passed CI testing. The framework uses this endpoint to ensure reliable version selection.
Streams are per major version: 4.x releases are published in 4-stable / 4-dev-preview and 5.x releases in 5-stable / 5-dev-preview. Always derive the stream from the version's major — querying 4-stable for a 5.x version returns nothing.
The framework supports special version mappings for the major version transition from 4.x to 5.x:
| Target | Baseline | Upgrade Path |
|---|---|---|
5.0 |
4.22.x |
4.22 → 5.0 (first major bump) |
5.1 |
4.23.x |
4.23 → 5.1 (second path to 5.x) |
5.2+ |
5.(x-1) |
Normal sequential progression |
Examples:
# Compare 4.22 → 5.0
./scripts/gap-all.sh --version 5.0
# Resolves to: baseline=4.22.15, target=5.0.0-rc.0
# Compare 4.23 → 5.1
./scripts/gap-all.sh --version 5.1
# Resolves to: baseline=4.23.0-rc.1, target=5.1.0-rc.0
# Compare 5.1 → 5.2 (normal progression)
./scripts/gap-all.sh --version 5.2
# Resolves to: baseline=5.1.5, target=5.2.0-rc.0See Validation Checks for detailed information about 5.x version resolution.
- 📘 Overview - What gap analysis does and how it works
- ✅ Validation Checks - Details about all 13 validation checks
- 🚀 Getting Started - Installation and basic usage
- ⚙️ Configuration - CLI arguments, environment variables, version resolution
- 🔧 Development - Contributing and customization
- 🧩 Step-Registry Workflows - ci-operator step registry: the 2 gap-analysis workflows (aggregated, independent) + step contracts (GA readiness is a standalone individual-only step, not in CI)
Additional Resources:
- 📊 Report Documentation - Report formats and viewing
- 🐳 Container Image - CI container image details
- GA Readiness Validation - Standalone pre-GA script for SREs (not in CI pipeline)
gap-analysis/
├── scripts/ # Executable scripts
│ ├── gap-aws-sts.py # AWS STS policy analysis
│ ├── gap-gcp-wif.py # GCP WIF policy analysis
│ ├── gap-ocp-gate-ack.py # OCP admin gate acknowledgment analysis
│ ├── gap-versions-channels.py # Version & channel availability analysis
│ ├── gap-ocm-version-gate.py # OCM version gate analysis
│ ├── gap-feature-gates.py # Feature gate analysis (informational)
│ ├── gap-api-resources.py # API Resources and CRD Diff Validation
│ ├── gap-critical-alerts.py # Critical Alerts Diff Validation
│ ├── gap-cluster-install.py # Cluster Install and Delete Validation
│ ├── gap-e2e-validation.py # Target E2E Validation and alert monitoring
│ ├── gap-upgrade-e2e.py # Upgrade Validation from Y-1 to Y with E2E Tests
│ ├── gap-all.sh # Run all analyses
│ ├── lib/ # Shared libraries
│ └── prod/ # Production scripts (GA readiness validation)
│
├── reports/ # Generated reports (default location)
├── skills/ # Claude AI skills
├── docs/ # Documentation
├── ci-operator/ # ci-operator step registry (refs, chain, 2 workflows)
│ └── step-registry/rosa/gap-analysis/
└── ci/ # CI configuration and container image
Understand IAM permission and feature gate changes before committing to a version upgrade.
Identify new cloud permissions and assess their security implications.
Track cloud permission evolution across OpenShift versions for security compliance.
Automatically detect policy changes in continuous integration workflows.
Scripts are designed for CI/CD integration:
| Script | Exit 0 | Exit 1 |
|---|---|---|
gap-aws-sts.py |
Successful execution | Execution error OR validation FAIL (checks 1-2) |
gap-gcp-wif.py |
Successful execution | Execution error OR validation FAIL (checks 3-4) |
gap-ocp-gate-ack.py |
Successful execution | Execution error OR validation FAIL (check 5) |
gap-versions-channels.py |
Successful execution | Execution error OR validation FAIL (check 6) |
gap-ocm-version-gate.py |
Successful execution | Execution error OR validation FAIL (check 7) |
gap-feature-gates.py |
Always on success | Execution error only (check 8 is informational) |
gap-api-resources.py |
Always on success | Execution error only (check 9 is informational; missing snapshots SKIP) |
gap-critical-alerts.py |
Always on success | Execution error only (check 10 is informational; missing snapshots SKIP) |
gap-cluster-install.py |
Always on success | Execution error only (check 11 is informational; missing snapshots SKIP) |
gap-e2e-validation.py |
Always on success | Execution error only (check 12 is informational; missing JUnit SKIP; failed tests reported in the report) |
gap-upgrade-e2e.py |
PASS or SKIP (missing upgrade JUnit) | Execution error OR validation FAIL (check 13; failed post-upgrade e2e or unhealthy COs) |
gap-all.sh |
All checks 1-7 and 13 pass | Any check 1-7 or 13 fails OR execution error |
Important: Validation distinguishes between errors and warnings:
- ERRORS (missing expected changes): Validation FAILS → exit 1
- WARNINGS (unexpected changes in managed-cluster-config): Validation PASSES with warnings → exit 0
When unexpected changes are detected, reports include GitHub PR links showing which PR introduced the change, helping identify the context and reasoning behind differences from the OCP payload.
# Run full analysis; exits 1 if any validation checks fail
./scripts/gap-all.sh --baseline 4.21 --target 4.22
# Parse JSON reports for programmatic analysis
jq -e '.comparison.actions.target_only | length > 0' reports/gap-analysis-aws-sts_*.jsonSee Getting Started and Validation Checks for detailed examples.
With Claude Code installed, simply ask:
"Compare AWS STS policies between OpenShift 4.21 and 4.22"
"Analyze feature gate changes between versions"
"Run a full gap analysis for 4.21 to 4.22"
Claude will execute the scripts and provide intelligent analysis and recommendations.
Gap analysis scripts use the same underlying approach as osdctl iampermissions diff:
# Both use: oc adm release extract --credentials-requests
osdctl iampermissions diff -c aws -b 4.21 -t 4.22
# Gap analysis adds:
# - Automatic report generation (HTML, JSON)
# - Feature gate analysis
# - Combined cross-platform analysis
# - CI/CD-friendly exit codes
python3 ./scripts/gap-aws-sts.py --baseline 4.21 --target 4.22We welcome contributions! See Development Guide for:
- Setting up development environment
- Testing scripts locally
- Code style guidelines
- Contribution workflow
For issues or questions:
- Get in touch with ROSA SRE team
- Review documentation
Apache License 2.0