Skip to content

Add medik8s-operator-subscribe Prow step for OLM operator installation#79547

Open
ugreener wants to merge 1 commit into
openshift:mainfrom
ugreener:rhwa-operator-subscribe
Open

Add medik8s-operator-subscribe Prow step for OLM operator installation#79547
ugreener wants to merge 1 commit into
openshift:mainfrom
ugreener:rhwa-operator-subscribe

Conversation

@ugreener
Copy link
Copy Markdown
Contributor

@ugreener ugreener commented May 20, 2026

Summary

Adds a reusable Prow step medik8s-operator-subscribe that installs medik8s/RHWA operators via OLM Subscription from an existing CatalogSource. Designed to run after the medik8s-catalogsource step (PR #79373).

What this step does

  1. Creates namespace openshift-workload-availability with privileged PSA labels
  2. Creates OperatorGroup (validates no conflicting OGs exist)
  3. For each operator in OPERATORS (comma-separated): verifies PackageManifest exists, creates Subscription
  4. Waits for all CSVs to reach Succeeded phase (10m timeout per operator)
  5. Dumps comprehensive debug info on failure (Subscription, InstallPlan, events)

Design pattern

Based on the proven cert-manager-install-operator step (used by 33+ nightly configs). Key additions:

  • Multi-operator support via comma-separated OPERATORS env var
  • Reads CatalogSource name from ${SHARED_DIR}/catsrc_name for step chaining
  • Multiple OperatorGroup validation (fails fast on >1 OG, matching optional-operators-subscribe behavior)

Files

ci-operator/step-registry/medik8s/operator-subscribe/
├── OWNERS
├── medik8s-operator-subscribe-commands.sh
├── medik8s-operator-subscribe-ref.metadata.json
└── medik8s-operator-subscribe-ref.yaml

Test plan

  • Rehearsal jobs pass (YAML, metadata, OWNERS validation)
  • Step is visible in step registry after merge
  • Downstream: will be used by periodic job configs (RHWA-1022, RHWA-1023)

Jira: RHWA-1021

Overview

This PR adds a reusable OpenShift CI Prow step named medik8s-operator-subscribe to the ci-operator step registry. The step automates installation of medik8s / RHWA operators via OLM Subscriptions and is intended to run after the medik8s-catalogsource step so it can consume the CatalogSource produced there.

Changes (practical impact)

Added files under ci-operator/step-registry/medik8s/operator-subscribe/ that affect OpenShift CI job execution and step registry metadata:

  • OWNERS — declares approvers and reviewers (beekhof, clobrano, maximunited, mshitrit, razo7, slintes, ugreener).
  • medik8s-operator-subscribe-commands.sh — implementation script that:
    • Sources proxy settings from ${SHARED_DIR}/proxy-conf.sh if present and reads CatalogSource name from ${SHARED_DIR}/catsrc_name to chain with the catalogsource step.
    • Creates the install namespace openshift-workload-availability and applies privileged PodSecurity labels.
    • Ensures exactly one OperatorGroup targets the installation namespace (fails if >1 OperatorGroup exists).
    • For each operator in the comma-separated OPERATORS env var:
      • Verifies the operator’s PackageManifest exists in openshift-marketplace filtered by the configured CatalogSource.
      • Creates an Automatic-install Subscription using OO_CHANNEL and the configured catalog source.
      • Waits for the subscription’s installed CSV and then waits for that CSV to reach Succeeded, with a 10-minute timeout per operator; on failure it dumps Subscription/InstallPlan/events/CSV YAML for debugging.
    • Prints installed CSVs on success and exposes a main() entrypoint for the step.
  • medik8s-operator-subscribe-ref.yaml — CI step definition that references the implementation, configures environment variables (OPERATORS, CATALOG_SOURCE, OO_CHANNEL, INSTALL_NAMESPACE), resource requests, and a 10-minute grace period for the job container.
  • medik8s-operator-subscribe-ref.metadata.json — registry metadata linking the step to the OWNERS list.

Design notes

  • Follows the cert-manager-install-operator step pattern and mirrors optional-operators-subscribe behavior for OperatorGroup validation.
  • Adds multi-operator support via comma-separated OPERATORS and explicit catalog-source chaining via ${SHARED_DIR}/catsrc_name.

Impact and next steps

  • Enables downstream periodic jobs (e.g., RHWA-1022, RHWA-1023) to install and verify medik8s/RHWA operators in OpenShift CI clusters.
  • Required follow-ups: ensure rehearsal jobs pass (YAML/metadata/OWNERS validation) and add the step to downstream job configs where needed.

@ugreener
Copy link
Copy Markdown
Contributor Author

/pj-rehearse auto-ack

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

@ugreener: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Walkthrough

Adds a ci-operator step medik8s-operator-subscribe: OWNERS and metadata files, a step YAML exposing env vars and resources, and a Bash implementation that creates namespace/OperatorGroup, creates Subscriptions for listed operators, and waits for CSVs to reach Succeeded.

Changes

medik8s-operator-subscribe CI Step

Layer / File(s) Summary
Step definition, metadata, and ownership
ci-operator/step-registry/medik8s/operator-subscribe/OWNERS, ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.metadata.json, ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.yaml
Adds OWNERS with approvers/reviewers, step metadata linking the YAML, and the step YAML that defines env vars (OPERATORS, OO_CATALOGSOURCE_NAME, OO_CHANNEL, OO_INSTALL_NAMESPACE), resource requests, and execution settings.
Script helpers for namespace, OperatorGroup, manifest, and subscription
ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-commands.sh
Adds helper functions: set_proxy, ensure_namespace, ensure_operatorgroup, wait_for_package_manifest, create_subscription, and wait_for_csv including polling and failure diagnostics.
Main orchestration and entrypoint
ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-commands.sh
Adds main() to parse OPERATORS, optionally override catalog source, ensure prerequisites, create Subscriptions for each package, wait for CSV success, and exit with a summary; script invokes main at end.

Sequence Diagram

sequenceDiagram
  participant CI_Script as medik8s-operator-subscribe.sh
  participant SharedDir
  participant openshift_marketplace
  participant ClusterAPI as oc/Kubernetes
  CI_Script->>SharedDir: read proxy conf / catsrc_name (optional)
  CI_Script->>ClusterAPI: oc apply namespace + OperatorGroup
  CI_Script->>openshift_marketplace: poll PackageManifest for package (catalog label)
  CI_Script->>ClusterAPI: oc apply Subscription (sourceNamespace: openshift-marketplace)
  CI_Script->>ClusterAPI: poll Subscription -> installedCSV
  CI_Script->>ClusterAPI: oc wait CSV conditions -> Succeeded (or emit diagnostics)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

lgtm, jira/valid-reference

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding a Prow step for OLM operator installation with clear focus on the medik8s-operator-subscribe step.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed This PR adds CI/CD infrastructure files (YAML configs, Bash scripts, OWNERS file) but no Ginkgo test files. The custom check applies only to Ginkgo test names, which are not present in this PR.
Test Structure And Quality ✅ Passed PR adds CI infrastructure files (bash script, YAML, JSON, OWNERS) but no Ginkgo test code. Custom check for Ginkgo test quality is not applicable to this PR.
Microshift Test Compatibility ✅ Passed PR adds no Ginkgo e2e tests; only Bash script, YAML, JSON, and OWNERS files. Check not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests added in this PR. Files added are: OWNERS config, Bash script, JSON metadata, and YAML CI step definition—not Go test files.
Topology-Aware Scheduling Compatibility ✅ Passed Script creates Namespace, OperatorGroup, and OLM Subscriptions without topology-specific scheduling constraints. Operator workload scheduling is delegated to the installed operators themselves.
Ote Binary Stdout Contract ✅ Passed PR adds only YAML/JSON configurations and Bash script; no Go binaries or test code subject to OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add any Ginkgo e2e tests. It adds CI/CD configuration files (OWNERS, YAML metadata, and a Bash script for OLM operator installation). The check is not applicable.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@openshift-ci openshift-ci Bot requested review from petr-muller and sosiouxme May 20, 2026 15:45
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ugreener

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2026
@openshift-merge-bot openshift-merge-bot Bot added the rehearsals-ack Signifies that rehearsal jobs have been acknowledged label May 20, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

@ugreener: no rehearsable tests are affected by this change

@ugreener ugreener force-pushed the rhwa-operator-subscribe branch from 017c405 to baca569 Compare May 20, 2026 16:02
Copy link
Copy Markdown
Contributor

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-commands.sh`:
- Around line 137-141: The check only verifies OPERATORS is non-empty but not
that it yields any valid package names after splitting/trimming; update the
validation so after you parse/sanitize OPERATORS (the code that splits on commas
and trims entries around the parsing loop at the block handling OPERATORS
parsing — references: the OPERATORS variable and the parsing logic around lines
that iterate over entries), count non-empty package names and, if that count is
zero, print the same ERROR/Example messages and exit 1; apply the same
validation to the second parsing area mentioned (the other block handling
OPERATORS parsing) so the step fails fast when parsing yields no valid packages.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: aa239257-d6a2-49b6-8f76-8fdbad9346a3

📥 Commits

Reviewing files that changed from the base of the PR and between 017c405 and baca569.

📒 Files selected for processing (4)
  • ci-operator/step-registry/medik8s/operator-subscribe/OWNERS
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-commands.sh
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.metadata.json
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.yaml
✅ Files skipped from review due to trivial changes (1)
  • ci-operator/step-registry/medik8s/operator-subscribe/OWNERS

Creates a reusable step that installs medik8s/RHWA operators via OLM
Subscription from an existing CatalogSource. Supports installing
multiple operators in a single step via comma-separated OPERATORS env var.

Based on the cert-manager-install-operator pattern: verifies PackageManifest
availability, creates Namespace + OperatorGroup + Subscriptions, waits for
CSVs to reach Succeeded phase with comprehensive debug output on failure.

Jira: RHWA-1021

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ugreener ugreener force-pushed the rhwa-operator-subscribe branch from baca569 to 157f949 Compare May 20, 2026 16:19
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@ugreener: no rehearsable tests are affected by this change

Note: If this PR includes changes to step registry files (ci-operator/step-registry/) and you expected jobs to be found, try rebasing your PR onto the base branch. This helps pj-rehearse accurately detect changes when the base branch has moved forward.

Interacting with pj-rehearse

Comment: /pj-rehearse to run up to 5 rehearsals
Comment: /pj-rehearse skip to opt-out of rehearsals
Comment: /pj-rehearse {test-name}, with each test separated by a space, to run one or more specific rehearsals
Comment: /pj-rehearse more to run up to 10 rehearsals
Comment: /pj-rehearse max to run up to 25 rehearsals
Comment: /pj-rehearse auto-ack to run up to 5 rehearsals, and add the rehearsals-ack label on success
Comment: /pj-rehearse list to get an up-to-date list of affected jobs
Comment: /pj-rehearse abort to abort all active rehearsals
Comment: /pj-rehearse network-access-allowed to allow rehearsals of tests that have the restrict_network_access field set to false. This must be executed by an openshift org member who is not the PR author

Once you are satisfied with the results of the rehearsals, comment: /pj-rehearse ack to unblock merge. When the rehearsals-ack label is present on your PR, merge will no longer be blocked by rehearsals.
If you would like the rehearsals-ack label removed, comment: /pj-rehearse reject to re-block merging.

Copy link
Copy Markdown
Contributor

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-commands.sh`:
- Around line 96-130: The function wait_for_csv currently waits up to 10m to see
.status.installedCSV and then an additional fixed 5m for the CSV to reach
Succeeded, allowing ~15m total; change the first polling loop (in wait_for_csv)
to only wait 5 minutes (e.g., reduce seq 1 60 to seq 1 30 with the same 10s
sleep) so the initial installedCSV wait is 5m and the subsequent oc wait
--timeout=5m keeps the per-operator end-to-end timeout to 10m; update the
user-facing attempt message if needed to match the new attempt count.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 30e3fcaf-728f-42ba-bd2e-29cf95ca4c9f

📥 Commits

Reviewing files that changed from the base of the PR and between baca569 and 157f949.

📒 Files selected for processing (4)
  • ci-operator/step-registry/medik8s/operator-subscribe/OWNERS
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-commands.sh
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.metadata.json
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.yaml
✅ Files skipped from review due to trivial changes (2)
  • ci-operator/step-registry/medik8s/operator-subscribe/OWNERS
  • ci-operator/step-registry/medik8s/operator-subscribe/medik8s-operator-subscribe-ref.metadata.json

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 20, 2026

@ugreener: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/owners 157f949 link true /test owners

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. rehearsals-ack Signifies that rehearsal jobs have been acknowledged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant