-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce error codes on the Build CRD validations #463
Comments
I am loathe to support numeric error codes when Kubernetes has a much better alternative - status conditions. We have already discussed this as feature we want (see #307). With conditions we can probably do away with the top-level Condition types and Reason codes in status conditions give us the best of both worlds - a human-readable string backed by an API guarantee [1]. Tools can infer state and failure mode from these conditions, and developers can likewise infer state by inspecting the conditions YAML. Numeric error codes buried in a message string require end-users and tool builders to look up these codes in documentation that must be carefully maintained. This is adds toil and is IMO hostile to the user experience. |
@adambkaplan some key things:
|
Let’s step back a bit on this issue and associated PR. The problem context is as follows:
The real want is an API which lets an external tool understand why a The proposed solution is to prepend a numeric error code to the “Reason” field, which today is a free form string. The field retains its free form message, but the numeric prefix comes with an implied API guarantee - namely that number refers to one thing and one thing only. This is problematic because from an API perspective, we have no means of enforcing this guarantee. “Reason” is a free form string, and under this solution it remains a free form string with a convention that cannot be strictly enforced by Go code. It also adds overhead to end clients, which need to parse the numeric code to decipher the underlying reason the Build object did not register. I have proposed as an alternative using Kubernetes Conditions [1]. This lets us provide API stability through the @qu1queee has rightly identified that Build objects themselves don’t generate pods that would trigger reconciliation. Most objects that use Conditions have underlying pods that trigger reconciliation. The closest objects we have to Build in upstream communities are:
Given this information, adding a full Conditions array to the Build object may not make sense. I therefore propose the following middle ground that uses the conventions of Conditions, but not the full blown array.
This will address our goal of providing an API to understand why builds do not register, while retaining our ability to report detailed error messages. Does this make sense? [1] https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties |
@adambkaplan thanks, I need to sync with Zoe and Jordan around your reply, will provide some feedback soon. |
@adambkaplan yes, you are laying out a very nice proposal. I think that we will definitely not use Conditions for the Build, but as you said we should adopt some of the API Conditions best practices, and from this point of view, we are misusing the Now, the above is not related with what we were proposing in #483 . In #483 we are behind a way to standardize the "error message" . The error codes was the initial idea, which we all agree we should not longer pursuit ( @xiujuan95, @zhangtbj and myself). However, the question remains open, how can we achieve a better standardization of those error messages. Either if the error message is today under @xiujuan95 thanks for working on #483, but as discussed we should proceed to close it. |
issue shipwright-io#463 . Keep in mind this would be the second attempt to improve on this topic, we previously tried it with: - shipwright-io#483 Signed-off-by: Zoe <[email protected]>
@adambkaplan and others, for your information @xiujuan95 and myself started already working on the "Build refactoring", based on the comments on this issue, see our initial TODO list for changes qu1queee@4b69868. We think this should be a neat approach, so please take a look while we work on it, otherwise we will PR this soonish. |
issue shipwright-io#463 . Keep in mind this would be the second attempt to improve on this topic, we previously tried it with: - shipwright-io#483 Signed-off-by: Zoe <[email protected]>
issue shipwright-io#463 . Keep in mind this would be the second attempt to improve on this topic, we previously tried it with: - shipwright-io#483 Signed-off-by: Zoe <[email protected]>
issue shipwright-io#463 . Keep in mind this would be the second attempt to improve on this topic, we previously tried it with: - shipwright-io#483 Signed-off-by: Zoe <[email protected]>
issue shipwright-io#463 . Keep in mind this would be the second attempt to improve on this topic, we previously tried it with: - shipwright-io#483 Signed-off-by: Zoe <[email protected]>
From #457
Idea:
The Build controller is currently executing the following validations:
when a Build validation fails, the validation error will be propagated into the Build
.Status.Reason
field, e.g.:For the above validations and error message definition, we have full control on it. However, if third parties (e.g. UI/CLI teams) rely on those error messages, we will often break them whenever we apply changes (e.g. enhancements) on our error messages.
Acceptance Criteria:
We would like to make this error messages persistent across time. Because we understand the message will change, the solution we would like to have is to prepend the message with a well defined error code.
Having a prepended error code will ensure that the message can change over time, but third parties could rely only on the code, whilst this is never gonna change. A code can only be removed in the posterity.
This issue is about:
The text was updated successfully, but these errors were encountered: