Skip to content

refactor: Extract apply and update status steps - #872

Merged
maltesander merged 4 commits into
mainfrom
refactor/apply-and-status-steps
Aug 11, 2026
Merged

refactor: Extract apply and update status steps#872
maltesander merged 4 commits into
mainfrom
refactor/apply-and-status-steps

Conversation

@maltesander

@maltesander maltesander commented Aug 7, 2026

Copy link
Copy Markdown
Member

Description

  • extracts an apply step (controller/apply.rs) with an Applier, which owns the ClusterResources, applies every resource kind and deletes orphaned resources
  • extracts an update status step (controller/update_status.rs), which computes the OpaClusterStatus from the applied resources
  • adds a type state marker to KubernetesResources (Prepared, Applied), so update_status can only be called with resources that were actually applied, not merely built. Applier::apply destructures KubernetesResources without a rest pattern, so a new resource kind fails to compile instead of silently never being applied.
  • moves the legacy "opacluster" field manager patch (Automatically migrate container name 23.1 -> 23.4 #444) into a private method on the Applier, running against the applied DaemonSets. Only the name and namespace are read from those objects, so this is equivalent to the previous behaviour.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

Moves resource application and status computation out of the reconcile
function and into dedicated controller/apply.rs and
controller/update_status.rs modules, following the same shape as the
airflow (#828) and hbase (#787) operators. reconcile_opa is now just
validate, build, apply, update_status.

KubernetesResources gains a type-state marker (Prepared, Applied), so
update_status can only be called with resources that were actually
applied, not merely built. Applier::apply destructures
KubernetesResources without a rest pattern, so a new resource kind
fails to compile instead of silently never being applied.

The legacy "opacluster" field manager patch (see #444) becomes a
private method on the Applier, running against the applied DaemonSets.
Only the name and namespace are read from those objects, so this is
equivalent to the previous behaviour.

Note that delete_orphaned_resources now runs before the status patch
instead of after it, matching the template operators.
@maltesander maltesander self-assigned this Aug 7, 2026
@siegfriedweber
siegfriedweber self-requested a review August 11, 2026 13:18
siegfriedweber
siegfriedweber previously approved these changes Aug 11, 2026

@siegfriedweber siegfriedweber left a comment

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.

LGTM

@maltesander
maltesander enabled auto-merge August 11, 2026 14:30
@maltesander
maltesander added this pull request to the merge queue Aug 11, 2026
Merged via the queue into main with commit 22c3506 Aug 11, 2026
18 checks passed
@maltesander
maltesander deleted the refactor/apply-and-status-steps branch August 11, 2026 14:43
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