Skip to content

product-lifecycle: Add plc_lookup.py CLI, migrate to v2 API#13

Open
harche wants to merge 1 commit into
openshift:mainfrom
harche:skills/cluster-update-plc-script
Open

product-lifecycle: Add plc_lookup.py CLI, migrate to v2 API#13
harche wants to merge 1 commit into
openshift:mainfrom
harche:skills/cluster-update-plc-script

Conversation

@harche

@harche harche commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces inline curl/python one-liners in product-lifecycle SKILL.md with a standalone Python CLI (plc_lookup.py) wrapping the Red Hat Product Life Cycle API v2
  • Addresses review feedback from PR OTA-1963: skills: Add cluster-update skills (update-advisor, product-lifecycle) #6: v1→v2 migration, all 5 support status types, drop PLCC acronym, proper error handling
  • Adds pagination (--limit, --offset) for broad queries
  • Includes 46 tests (unit with mocked API + integration against live API)
  • Updates update-advisor SKILL.md cross-references

Builds on top of #6 (that PR stays open).

CLI usage

python3 cluster-update/product-lifecycle/scripts/plc_lookup.py products "logging for Red Hat OpenShift"
python3 cluster-update/product-lifecycle/scripts/plc_lookup.py products "OpenShift" --ocp 4.21 --limit 5
python3 cluster-update/product-lifecycle/scripts/plc_lookup.py olm-check --ocp 4.21 --operators '[{"package":"cluster-logging"}]'

Test plan

  • All 46 tests pass locally (python3 -m unittest — 19 unit + 17 integration against live API + 10 pagination)
  • Verify plc_lookup.py -h shows clean help output
  • Verify script works from repo root path
  • Verify SKILL.md paths resolve correctly

🤖 Generated with Claude Code

@openshift-ci openshift-ci Bot requested review from DavidHurta and mrunalp April 21, 2026 22:26
@openshift-ci

openshift-ci Bot commented Apr 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: harche

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 Apr 21, 2026
@harche

harche commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

/hold

will look into this after #6

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2026
@harche harche force-pushed the skills/cluster-update-plc-script branch from ce82a3e to b0a3f09 Compare May 29, 2026 15:24
@harche

harche commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Testing Results

Eval Framework (Agent-in-the-loop)

Ran 12 skill evals via the agentic-skills eval framework using Claude on Vertex AI. Test queries use the exact prompt format CVO proposals send to the agent, with real OLM operator data and readiness JSON.

product-lifecycle (7 evals)

Test Case Query Expected Result
plc_proposal_olm_batch_check 5-operator batch olm-check from proposal context 5 checked, 3 unavailable
plc_cluster_logging_supported cluster-logging v6.5 lifecycle + OCP 4.21 compat supported, compatible
plc_web_terminal_compat_check web-terminal supported version for OCP 4.21 no supported version for 4.21
plc_compliance_operator_status compliance-operator v1.9 lifecycle status found, supported
plc_ocp_platform_status OCP 4.21 platform lifecycle supported
plc_ocp_old_version_extended OCP 4.14 lifecycle phase extended
plc_batch_known_operators_only 2-operator batch check (cluster-logging + web-terminal) both found, neither EOL

update-advisor (5 evals)

Each test sends a complete readiness JSON (same format CVO produces) and verifies the agent's upgrade decision:

Test Case Scenario Expected Decision Result
advisor_healthy_cluster_recommend All 9 checks pass, no issues recommend
advisor_degraded_operator_caution 1 degraded operator (authentication) caution
advisor_api_deprecation_block Removed API with 1250 active requests block
advisor_etcd_unhealthy_block 1 of 3 etcd members not ready block
advisor_errored_checks_escalate 7 of 9 readiness checks errored (API unreachable) escalate

All 12 agent evals + 46 unit/integration tests passed.

End-to-End with CVO Readiness Data

Tested the full proposal → readiness → skill pipeline using a custom CVO build from openshift/cluster-version-operator#1395 deployed to a live OCP 4.21.5 cluster on GCP (6 nodes).

Installed OLM operators for testing:

  • cluster-logging v6.5.1 (channel: stable-6.5)
  • compliance-operator v1.9.0 (channel: stable)
  • openshift-pipelines-operator-rh v1.22.0 (channel: latest)
  • web-terminal v1.16.0 (channel: fast)
  • devworkspace-operator v0.41.0 (channel: fast)

Flow verified:

  1. CVO creates proposals with readiness JSON containing olm_operator_lifecycle data for all 5 operators
  2. The update-advisor skill analyzes readiness data and classifies findings per its decision policy
  3. The update-advisor calls product-lifecycle to cross-check operators against the PLC API
  4. plc_lookup.py olm-check correctly returns lifecycle data for cluster-logging and web-terminal, reports "unavailable" for compliance-operator, openshift-pipelines, and devworkspace-operator
  5. plc_lookup.py products finds compliance-operator by product name even when olm-check can't match by package name

Cluster readiness summary (from proposal ota-4-21-5-to-4-21-16):

  • 9/9 readiness checks passed in 2.56s
  • 34 ClusterOperators healthy, 6 nodes ready, 3/3 etcd members
  • 207 CRDs (0 version issues), 21 PDBs (0 blocking)
  • OVNKubernetes, TLS Intermediate, no deprecated APIs
  • 5 OLM operators detected with versions, channels, and install status

Ground truth verification

All expected values in evals were verified against the live PLC v2 API:

$ plc_lookup.py products "Red Hat OpenShift Container Platform" --ocp 4.21  →  4.21: supported
$ plc_lookup.py products "Red Hat OpenShift Container Platform" --ocp 4.14  →  4.14: extended
$ plc_lookup.py products "logging for Red Hat OpenShift" --ocp 4.21         →  6.5: supported, ocp_compatible=true
$ plc_lookup.py products "compliance operator"                              →  v1.9: supported
$ plc_lookup.py olm-check --ocp 4.21 --operators '[5 operators]'           →  2 found, 3 unavailable

🤖 Generated with Claude Code

@harche

harche commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

/cc @wking

@openshift-ci openshift-ci Bot requested a review from wking May 29, 2026 15:33
@harche harche force-pushed the skills/cluster-update-plc-script branch from 7e43631 to eace3b2 Compare May 29, 2026 15:41
@harche

harche commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

/hold improving evals with better data.

@harche harche force-pushed the skills/cluster-update-plc-script branch 4 times, most recently from f01f289 to 81bf078 Compare May 29, 2026 16:38
@harche harche marked this pull request as draft May 29, 2026 17:46
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 29, 2026
@harche

harche commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Converting to draft, I need to make a few more changes before it is ready for the review.

@harche harche force-pushed the skills/cluster-update-plc-script branch from 81bf078 to 0544f37 Compare May 29, 2026 17:53
@harche harche marked this pull request as ready for review May 29, 2026 18:38
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 29, 2026
@harche

harche commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Converting to draft, I need to make a few more changes before it is ready for the review.

back to open.

@openshift-ci openshift-ci Bot requested review from Cali0707 and PratikMahajan May 29, 2026 18:38
@harche harche force-pushed the skills/cluster-update-plc-script branch from 0544f37 to ef3bf25 Compare June 1, 2026 20:38
@harche

harche commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Cross-PR testing

Tested end-to-end with:

All three deployed together on OCP 4.21.5 cluster. The product-lifecycle skill (plc_lookup.py) successfully runs inside the agent sandbox, querying the PLCC API and populating operator lifecycle data in the ota_olm_operator_status component.

The skill path fix (cluster-update/...product-lifecycle/...) is required for the sandbox mount paths to resolve correctly.

@harche

harche commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

/override ci/prow/eval

@openshift-ci

openshift-ci Bot commented Jun 2, 2026

Copy link
Copy Markdown

@harche: Overrode contexts on behalf of harche: ci/prow/eval

Details

In response to this:

/override ci/prow/eval

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.

@harche

harche commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@harche

harche commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

OTA-1972: Update API types to match current agentic.openshift.io CRDs openshift/cluster-update-console-plugin#8

/hold cancel

will take it up as follow up.

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 4, 2026
@@ -0,0 +1,132 @@
# product-lifecycle eval

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@harche maybe we want to mirror the OWNERS from the main skill into here somehow so that the same group of people can own the skill + the evals?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For this PR to move forwarded I have added the symlink to the OWNERS file evals/skills/product-lifecycle/OWNERS → ../../../cluster-update/OWNERS

@harche harche force-pushed the skills/cluster-update-plc-script branch from ef3bf25 to 94bab65 Compare June 15, 2026 18:37
@harche

harche commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

/override ci/prow/eval

@openshift-ci

openshift-ci Bot commented Jun 15, 2026

Copy link
Copy Markdown

@harche: Overrode contexts on behalf of harche: ci/prow/eval

Details

In response to this:

/override ci/prow/eval

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.

@jrangelramos

Copy link
Copy Markdown
Member

/lgtm

@@ -1,9 +1,9 @@
# Product Life Cycle API Reference
# Product Life Cycle API Reference (v2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: as far as the skill goes, it doesn't need to care about v1 vs. v2, right? Actually, we don't even need this reference at all now that the API is wrapped in plc_lookup.py? This api-details.md should pivot to just being about "how to use plc_lookup.py"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — api-details.md was orphaned (nothing in the repo linked to it), and SKILL.md already fully documents the plc_lookup.py CLI. Rather than pivoting it to a "how to use plc_lookup.py" doc that would duplicate SKILL.md, I removed the reference file entirely.

When the readiness data includes olm_operator_lifecycle results, use
the product-lifecycle skill to cross-reference each operator's package
name against the Red Hat Product Life Cycle API. Report support phase,
EOL dates, and OCP compatibility from PLCC alongside the OLM data.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I it looks like evals are the only place in this repo we use the PLCC acronym as of this pull:

$ git grep -i plcc origin/pr/13 | grep -v png
origin/pr/13:evals/skills/product-lifecycle/system_prompt.md:EOL dates, and OCP compatibility from PLCC alongside the OLM data.
origin/pr/13:evals/skills/update-advisor/system_prompt.md:EOL dates, and OCP compatibility from PLCC alongside the OLM data.

I think we should use "Product Life Cycle" or "Red Hat Product Life Cycle" or some other string drawn from cluster-update/product-lifecycle/SKILL.md to make it easy for AI to make the connection to that skill.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Replaced PLCC with "the product-lifecycle skill" in both eval system prompts (product-lifecycle and update-advisor) so the wording is drawn from the skill and easier for the model to connect. No PLCC left anywhere in the repo.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2026
Add standalone Python CLI (`plc_lookup.py`) wrapping the Red Hat Product
Life Cycle API v2 for querying product support status, EOL dates, and
OCP version compatibility. Replaces inline curl/python one-liners.

Commands:
- `products` — query by product name with optional OCP compat check
- `olm-check` — batch check OLM operators against a target OCP version

Includes 46 tests (unit with mocked API + integration against live API),
3 agent eval test cases (all passing on Claude via Vertex AI), and
OWNERS updates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@harche harche force-pushed the skills/cluster-update-plc-script branch from 94bab65 to 27b285a Compare June 16, 2026 12:47
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2026
@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@harche

harche commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

/override ci/prow/eval

@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

@harche: Overrode contexts on behalf of harche: ci/prow/eval

Details

In response to this:

/override ci/prow/eval

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.

@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

@harche: all tests passed!

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants