Skip to content

fix(maintenance): an unready ServicePrincipal is not a schedule, and the CronJob is removed (operator#583) - #584

Merged
schwarztrinker merged 1 commit into
mainfrom
fix/583-maintenance-readiness
Nov 12, 2026
Merged

schwarztrinker merged 1 commit into
mainfrom
fix/583-maintenance-readiness

Conversation

@schwarztrinker

Copy link
Copy Markdown
Contributor

What

reconcile_catalog in crates/stardelt-operator/src/maintenance.rs has three arms on the pipeline
principal instead of two:

principal condition CronJob
absent False NoRunner (unchanged) maint-<catalog> deleted
present, status.ready: false False RunnerNotReady, message from the principal's own non-True condition (ClientNotSetUp: …) or the missing sp-<principal> Secret maint-<catalog> deleted
present, ready True Scheduled (unchanged) applied

delete_ignoring_not_found (controller.rs) is now pub(crate) so the controller's 404-tolerant
delete is reused; the Jobs of maint-<catalog> go with the CronJob through owner references.

Patch applied exactly as the ticket supplies it (git apply 583.patch, extracted from the issue body).

Tests

  • new maintenance::tests::an_unready_pipeline_principal_writes_runner_not_ready_and_removes_the_job
    — asserts DELETE …/cronjobs/maint-mobility, no CronJob PATCH, status carries RunnerNotReady and
    ClientNotSetUp and no Scheduled.
  • renamed a_missing_pipeline_principal_writes_no_runner_and_removes_the_job — asserts the same DELETE
    and no CronJob PATCH (was: assertion that /cronjobs/ never appears).
  • the two mock principals standing for a ready principal now carry "status":{"ready":true}.

Verify

$ cargo fmt --check; echo $?
0
$ cargo test -p stardelt-operator --lib | tail -2
test result: ok. 623 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.43s
$ cargo check -p stardelt-operator --all-targets
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 05s
$ cargo clippy -p stardelt-operator --all-targets -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 20.37s

Mutation checks (each reverted afterwards):

# drop both DELETE calls  -> both arm tests fail
test result: FAILED. 2 passed; 2 failed; 0 ignored; 0 measured; 619 filtered out
# neutralise the readiness guard (Some(sp) if false && …) -> unready arm falls into Scheduled
test maintenance::tests::an_unready_pipeline_principal_writes_runner_not_ready_and_removes_the_job ... FAILED
test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 619 filtered out

Remaining

No CRD change, no chart change, no live cluster change: the image is rolled out separately.

Refs #583

…nJob is removed (operator#583)

- reconcile_catalog splits the Some arm on status.ready: unready writes
  MaintenanceReady=False reason=RunnerNotReady with the principal's own
  condition text, and applies no CronJob.
- The missing- and unready-principal arms delete maint-<catalog> (its Jobs
  go with it through owner references).
- delete_ignoring_not_found is pub(crate); two tests cover the arms.
Copilot AI lite review requested due to automatic review settings November 12, 2026 00:29

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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