fix(operator): surface runtime resource reconciliation errors in TrainJob status#3672
Open
AdeshDeshmukh wants to merge 1 commit into
Open
fix(operator): surface runtime resource reconciliation errors in TrainJob status#3672AdeshDeshmukh wants to merge 1 commit into
AdeshDeshmukh wants to merge 1 commit into
Conversation
…nJob status Signed-off-by: Adesh Deshmukh <adeshkd123@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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.
What this PR does / why we need it:
When
reconcileObjects()fails during TrainJob reconciliation (either duringruntime.NewObjects()or the SSAclient.Apply()), the error was previously only emitted as a Kubernetes Event viar.recorder.Eventf(). The TrainJob status was not updated to reflect the failure, leaving users unable to diagnose the issue viakubectl get trainjob— the job would appear stuck in a non-terminal state (e.g., "Pending") with no indication of what went wrong.Changes made:
New condition reason constant (
pkg/apis/trainer/v1alpha1/trainjob_types.go): AddedTrainJobResourcesCreationFailedReason = "ResourcesCreationFailed"following the existing convention for condition reason constants.Surface error in TrainJob status (
pkg/controller/trainjob_controller.go): Call the existingsetFailedCondition()helper whenreconcileObjects()fails, mirroring the established pattern used for unsupported runtimes (TrainingRuntimeNotSupported) and deadline exceeded (DeadlineExceeded). The Kubernetes Event is preserved for real-time notification.Fix latent overwrite bug in setTrainJobStatus (
pkg/controller/trainjob_controller.go): UpdatedsetTrainJobStatus()to generically preserve any pre-existing Failed condition instead of using a fragile reason-specific whitelist (which only preservedDeadlineExceeded). In a partial SSA apply failure, the runtime could return a non-nil status that would silently overwrite and erase the Failed condition. This fix ensures the condition survives regardless of the reason.Unit test (
pkg/controller/trainjob_controller_test.go): Added test coverage forsetTrainJobStatus()verifying that Failed conditions withResourcesCreationFailedandDeadlineExceededreasons are preserved with both nil and non-nil runtime status returns.Resolves the TODO left by astefanutti at trainjob_controller.go:125.
Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, ...format, will close the issue(s) when PR gets merged):Fixes #3671
Checklist: