endpoint resource: fix terminal condition showing up in recoverable #18
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 of Changes
aws-controllers-k8s/sagemaker-controller#7 introduced ability to set terminal conditions for failed update scenarios by returning an error (FailUpdateError) from customUpdateEndpoint method and catching it in customUpdateConditions
aws-controllers-k8s/code-generator#40 added a catch block for all errors which are non-terminal which executes before
customUpdateConditions. SinceFailUpdateErroris a custom error, it started showing up in recoverable in addition to terminal condition once recoverable condition was introduced. Example:This PR fixes this issue by creating making
FailUpdateErroran awserr type of error and using it as one of the terminal codes just like any other AWS error. This also simplifies the custom code in customUpdateConditions which now only needs to check forStatus.EndpointStatus == Failedwhile setting terminal conditionif ko.Status.Conditions == nilbecause all methods - sdkCreate, sdkFind, sdkUdpate and updateConditions - set it to an empty list alreadyTesting
Locally using pytest and manually