feat: standard metav1.Condition projection on job status - #16
Merged
Conversation
kylegalloway
force-pushed
the
worktree-feat+standard-conditions
branch
2 times, most recently
from
May 29, 2026 21:18
8d54b04 to
309d8e1
Compare
Adds []metav1.Condition to ZarfPackageJobStatus and UDSBundleJobStatus. Conditions are derived from the existing phase state machine on every updateStatus call — phases are kept intact as the internal state machine for action chaining and reconcile gating. Ready: True=succeeded / False=failed / Unknown=in-progress Reconciling: True while not in a terminal phase BuildSucceeded / CreateSucceeded / PublishSucceeded / DeploySucceeded: per-operation outcomes derived from OperationStatus.Phase LastTransitionTime is preserved when a condition's status is unchanged. Also fixes updateStatus to merge into existing status rather than replace it entirely, preventing prior operation fields (e.g. buildStatus) from being silently lost when a chained action (e.g. publishStatus) is written. Enables: kubectl wait --for=condition=Ready=True zpj/my-job
Reconciling=False with Reason=Progressing was semantically incoherent — like a 'CLOSED' sign that still says 'Be Right Back'. Terminal phases now carry the correct reason (Succeeded/Failed) so kubectl get output doesn't lie to operators. OperationConditionTypes was a map, which in Go means the per-operation conditions appeared in random order on every reconcile. Converted to an ordered slice so the status output is stable across calls. Also stubs ConditionReasonSuspended as an explicit forward declaration, adds klog.ErrorS for the silent drop in conditionsToUnstructured, and covers both fixes with TestDeriveConditions_ReconcilingReason and TestDeriveConditions_DeterministicOrder.
kylegalloway
force-pushed
the
worktree-feat+standard-conditions
branch
from
May 29, 2026 21:28
309d8e1 to
3b33c57
Compare
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.
Summary
[]metav1.ConditiontoZarfPackageJobStatusandUDSBundleJobStatusas an additive projection layer on top of the existing phase state machineBuildPublish→ trigger publish after build) and reconcile gating (skip terminal resources). Conditions project phase outward for ecosystem tooling.updateStatusreplaced the entire status map on every write, silently dropping prior operation fields (e.g.buildStatusdisappearing whenpublishStatuswas written during aBuildPublishchain)Conditions added
ReadyReconcilingBuildSucceededCreateSucceededPublishSucceededDeploySucceededLastTransitionTimeis preserved when a condition's status hasn't changed.Usage
Test plan
TestDeriveConditions_Ready— all 6 phases map correctly to Ready/Reconciling statusTestDeriveConditions_OperationConditions— per-operation conditions derived from status fields; absent operations produce no conditionTestDeriveConditions_PreservesLastTransitionTime— unchanged status keeps original timestampTestDeriveConditions_TransitionsLastTransitionTime— changed status gets new timestampTestConditionsRoundtrip—[]metav1.Conditionsurvives unstructured serialization round-tripTestDeriveConditions_ReconcilingReason— terminal phases carry Succeeded/Failed reason, not ProgressingTestDeriveConditions_DeterministicOrder— condition slice order is stable across callsgo test ./...— all existing tests pass