Open pmorie opened 7 years ago
can you give an example magic value?
@derekwaynecarr a couple specific examples:
k8s-magic-thing
), the behavior of the resource with the reference field completely changesWhen a reference field has the magic name (k8s-magic-thing), the behavior of the resource with the reference field completely changes
The behavior of resources should be consistent and predictable. We do have some APIs which have flavors, but are overall consistent in intent and handling. There are two approaches to doing this:
ServiceSpec.Type
field. It is a strict enumeration of allow types which can flavor the behavior, but the overall thing is always a service. It always behaves as a service and the field is dedicated to only flavoring it.VolumeSource
type. There are many concrete flavors of volumesource, but only one may be set in the object. Again, these always behave as volumesources and this is simply choosing a subtype.When a field holding a duration has a zero-value, it means 'never' (this one might actually be okay, but i'm not sure if I'm remembering this one accurately)
Deciding how to handle default values for objects with default behavior that works in the majority of cases is a case-by-case decision. I don't think I'd want to dictate how people handle it, although "never timeout" usually isn't a good default, so the behavior there seems undesirable.
Oh and I should say that having been through this in several APIs, I think the approach of "on of many pointers" ends up working better since it allows specific descriptions of what you want and makes future growth easy.
The behavior of resources should be consistent and predictable. We do have some APIs which have flavors, but are overall consistent in intent and handling. There are two approaches to doing this:
Yep, and those two approaches should be sufficient to differentiate behaviors of resources where necessary
Magic values sound evil
The API conventions do state the following:
The term "type" should be used for distinguishing sub-categories within objects or subobjects.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Prevent issues from auto-closing with an /lifecycle frozen
comment.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or @fejta
.
/lifecycle stale
/remove-lifecycle stale
I will either PR this or close it.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten /remove-lifecycle stale
/remove-lifecycle rotten
/area developer-guide
We've had a number of questions during API design for service-catalog about using magic values. I believe the prevailing consensus amongst the owners of the project is that magic values in APIs are undesirable, but the API convention document does not give any treatment to this topic. Varations of how this has come up:
I think it would be great to document this and get clarity for newcomers to the project, but would like to see some agreement in this issue before I file a PR.