-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
API types that contain label selector fields, i.e. EndpointSelector, ServiceSelector, etc., have inconsistent behavior. Specifically, label selector fields should document semantics when the field is nil
or empty
. According to kubernetes/kubernetes#25836, nil
and empty
should be treated the same.
Write (or solicit API owners to write/update) API docs as needed. Flag anything that tries to differentiate nil
from empty
. For legacy selectors (map[string]string
), nil
and empty
should always mean the same thing, and consider any that try to violate this. For modern selectors (metav1.LabelSelector
), it may be OK to distinguish nil
from empty
but ONLY IF the field is a pointer.
Write an API convention for documenting this. Ideally, a blob of text that can be used on all fields.
Bonus: write an API linter that checks that any metav1.LabelSelector field has this text in the comments.