refactor: Extract apply and update_status steps - #923
Open
maltesander wants to merge 4 commits into
Open
Conversation
Makes `KubernetesResources` generic over a marker type that records how far the resources have travelled through the reconcile pipeline. The build step now returns `KubernetesResources<Prepared>`. This prepares the extraction of the apply and update_status steps: once an `Applied` marker exists, the type system can enforce that the cluster status is derived from the resources the API server returned, and not from the ones that were merely built.
Moves the resource application out of `reconcile_trino` into a dedicated `controller::apply` module. The `Applier` owns the `ClusterResources` and turns `KubernetesResources<Prepared>` into `KubernetesResources<Applied>`, so later steps can require resources that Kubernetes actually acknowledged. `ensure_random_secrets` moves along, since it is a read-or-create client operation that cannot live in the client free build step. It stays outside `ClusterResources` on purpose, so orphan deletion never removes it and an existing Secret is never overwritten. The apply order is unchanged. Orphaned resources are now deleted before the status is patched instead of after, which matches the sibling operators.
Moves the cluster status computation out of `reconcile_trino` into a dedicated `controller::update_status` module. It accepts only `KubernetesResources<Applied>`, so the type system enforces that the conditions are derived from the resources the API server acknowledged and not from the ones that were merely built.
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Completes the
dereference -> validate -> build -> apply -> update_statuspipeline.KubernetesResourcesis now generic over aPrepared/Appliedmarker, so thecompiler enforces that the cluster status is derived from the resources the API
server acknowledged
controller::applywith anApplier, which also takes overensure_random_secrets(a read-or-create client operation, deliberately kept outof
ClusterResourcesso orphan deletion never removes it)controller::update_statusDefinition of Done Checklist
Author
Reviewer
Acceptance
type/deprecationlabel & add to the deprecation scheduletype/experimentallabel & add to the experimental features tracker