Skip to content

fix(approve-installplan): version-gate InstallPlan approval against p…#80

Merged
cjeanner merged 2 commits into
mainfrom
fix/version-gated-installplan-approval
Jul 20, 2026
Merged

fix(approve-installplan): version-gate InstallPlan approval against p…#80
cjeanner merged 2 commits into
mainfrom
fix/version-gated-installplan-approval

Conversation

@cjeanner

Copy link
Copy Markdown
Collaborator

…inned startingCSV

The Job could auto-approve an InstallPlan for a newer CSV than what pin-version pins. OLM treats startingCSV as a floor, not a ceiling — if the catalog offers a higher version in the same channel, OLM resolves to that version and the Job blindly approves it, causing version drift.

Read the Subscription's spec.startingCSV before polling. When set, only approve InstallPlans whose clusterServiceVersionNames list contains the pinned CSV; fail fast with a clear error when a wrong-version InstallPlan is found. When startingCSV is not set (no pin-version component), fall back to the original behavior.

@cjeanner cjeanner self-assigned this Jul 17, 2026
cjeanner and others added 2 commits July 20, 2026 09:35
…inned startingCSV

The Job could auto-approve an InstallPlan for a newer CSV than what
pin-version pins. OLM treats startingCSV as a floor, not a ceiling —
if the catalog offers a higher version in the same channel, OLM
resolves to that version and the Job blindly approves it, causing
version drift.

Read the Subscription's spec.startingCSV before polling. When set,
only approve InstallPlans whose clusterServiceVersionNames list
contains the pinned CSV; fail fast with a clear error when a
wrong-version InstallPlan is found. When startingCSV is not set
(no pin-version component), fall back to the original behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…etection

The previous check (`oc get openstack openstack`) races with the
openstack-operator-cr ArgoCD app which creates the OpenStack CR
before the Job reaches its detection logic. On initial install this
causes the Job to enter wait_for_new_version, which times out
because deployedVersion is not set until the full controlplane
deploys.

Check OpenStackVersion.status.deployedVersion instead: if absent,
this is an initial install (wait_for_crd); if present, it is a
genuine update (wait_for_new_version).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cjeanner
cjeanner force-pushed the fix/version-gated-installplan-approval branch from 78985ff to 0a253ce Compare July 20, 2026 07:35
@cjeanner
cjeanner marked this pull request as ready for review July 20, 2026 09:35
@cjeanner
cjeanner enabled auto-merge (squash) July 20, 2026 09:35
@cjeanner
cjeanner requested a review from aharivel July 20, 2026 09:35

@aharivel aharivel left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor nits (non-blocking)

  1. Double API call on mismatch (job.yaml ~L73-86) — when pinned CSV isn't found, it fetches all InstallPlans again to check for a wrong-version plan. Could cache the first oc get installplan result in a variable and reuse it. Only matters during mismatch, but it's two full API calls per retry iteration.
  2. Immediate exit 1 on wrong-version plan (job.yaml ~L88) — if a wrong-version InstallPlan appears momentarily before the correct one, job dies with no retry. Unlikely but possible if catalog index is slow. Could wait a few iterations before failing.
  3. Stale RBAC for openstacks — the old code used oc get openstack openstack which needed openstacks get/list permission. After this PR that codepath is gone, but the RBAC rule for operator.openstack.org/openstacks remains in rbac.yaml. Minor cleanup opportunity.

@cjeanner
cjeanner merged commit 625c843 into main Jul 20, 2026
2 checks passed
@cjeanner
cjeanner deleted the fix/version-gated-installplan-approval branch July 20, 2026 10:50
@cjeanner

Copy link
Copy Markdown
Collaborator Author

Minor nits (non-blocking)

1. Double API call on mismatch (job.yaml ~L73-86) — when pinned CSV isn't found, it fetches all InstallPlans again to check for a wrong-version plan. Could cache the first oc get installplan result in a variable and reuse it. Only matters during mismatch, but it's two full API calls per retry iteration.

2. Immediate exit 1 on wrong-version plan (job.yaml ~L88) — if a wrong-version InstallPlan appears momentarily before the correct one, job dies with no retry. Unlikely but possible if catalog index is slow. Could wait a few iterations before failing.

3. Stale RBAC for openstacks — the old code used oc get openstack openstack which needed openstacks get/list permission. After this PR that codepath is gone, but the RBAC rule for operator.openstack.org/openstacks remains in rbac.yaml. Minor cleanup opportunity.

We can refine it - though this specific job is mostly for CI. There's room for improvement anyway.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants