villebro opened a new pull request, #59:
URL: https://github.com/apache/superset-kubernetes-operator/pull/59

   ## Summary
   
   Post-refactor review pass on the single-CRD collapse and lifecycle pipeline 
overhaul. Bundles one real bug fix (maintenance page builder mutating the 
cached spec), tightens CEL validation on `lifecycle.clone.cronSchedule`, adds 
end-to-end and concurrency tests for the lifecycle pipeline, clarifies docs 
that overstated availability, and refactors the four-task pipeline to drive off 
a single descriptor table — eliminating four parallel `switch taskType` arms 
across `lifecycle.go`, `drain.go`, and `lifecycle_job.go`. `lifecycle.go` 
shrinks from 922 to 627 LOC and per-task wiring now follows the existing 
`lifecycle_clone.go` pattern, so adding a fifth task means appending one 
descriptor entry and one per-task file rather than touching 8+ call sites.
   
   ## Details
   
   ### Bug fix
   - `internal/controller/maintenance.go` — `buildMaintenanceFlatSpec` was 
assigning `spec.PodTemplate` and `spec.DeploymentTemplate` directly into the 
flat spec and then `append`-ing operator-managed volumes/mounts/env onto the 
resulting pointer, mutating the user-provided spec held in the informer cache. 
Fix: deep-copy the templates before injection. New regression test 
`TestBuildMaintenanceFlatSpec_DoesNotMutateInputSpec` calls the builder 
repeatedly and asserts the input spec's volume/mount/env counts stay at 1.
   
   ### CEL validation
   - `api/v1alpha1/superset_types.go` — `cronSchedule` now has a `Pattern` 
validation that rejects malformed expressions at admission. Runtime parse via 
`robfig/cron` stays as defense in depth.
   
   ### Tests
   - `lifecycle_pipeline_test.go` (new) — walks the full `clone → migrate → 
rotate → init` pipeline through fake Job status transitions, asserting each 
phase advances and the final state is `LifecycleComplete` with 
`LastLifecycleImage` advanced.
   - `TestReconcileLifecycleTaskJob_ConcurrentCreateProducesOneJob` (new) — 10 
racing goroutines call `reconcileLifecycleTaskJob` with deep-copied Superset 
objects; asserts exactly one Job in the fake client. Passes with `-race`.
   
   ### Docs
   - `docs/index.md` — "Zero-downtime upgrades" was internally contradictory 
(the same bullet describes a maintenance page). Reworded to "Maintenance-backed 
upgrades".
   - `docs/user-guide/lifecycle.md` — fixed the clone checksum equation (was 
missing `TargetImage`), added an explicit paragraph spelling out per-task 
semantic inputs and that checksums do NOT cover pod-level fields like 
resources/scheduling.
   
   ### Lifecycle refactor
   - New `lifecycle_taskdescriptor.go` — single source of truth for per-task 
wiring (suffix, phase, command/inputs builders, IsEnabled, BaseSpec accessor, 
status slot).
   - New `lifecycle_cascade.go` — `computeStepChecksum`, 
`walkLifecycleCascade`, `allTasksStillComplete`, `pendingLifecycleTasks`. The 
three callers that previously each had four near-identical `if cloneEnabled { … 
} if migrateEnabled { … }` blocks now share one walker.
   - New per-task files `lifecycle_migrate.go` / `lifecycle_rotate.go` / 
`lifecycle_init.go` mirror the existing `lifecycle_clone.go` layout.
   - Dropped `cloneEnabled, migrateEnabled, rotateEnabled, initEnabled` 
parameters from `drainIfNeeded`, `lifecycleNeedsDrain`, 
`prepareMaintenancePage`, `runLifecyclePipeline`, and `pruneDisabledTasks` — 
enablement is now derived from the descriptor table.
   - Added package-level doc on `lifecycle.go` explaining the dual phase enums 
(`lifecyclePhase*` for the lifecycle sub-state, `phase*` for the parent's 
high-level phase) and the file layout.
   - No behavior changes — every test that pinned the prior behavior still 
passes unchanged after dropping their parallel enabled-bool arguments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to