kubernetes/kubernetes

Audit all APIs for selector fields, ensure documented semantics when nil or empty.

Open

#25,836 opened on 2016年5月18日

GitHub で見る
 (8 comments) (0 reactions) (0 assignees)Go (122,268 stars) (43,066 forks)batch import
help wantedlifecycle/frozenpriority/backlogsig/architecture

説明

Service.spec.selector comments say "If empty, all pods are selected, if not specified, endpoints must be manually specified".

As far as I can tell this is not implemented, though. While Go understands the different between a nil slice and a non-nil slice with no elements, JSON does not. With an omitempty field, we get the field dropped in either case.

To actually achieve this semantic, we need the type to be a pointer, so omitempty applies to a nil pointer but not an empty map. But at least protobuf codegen does not support this, either. I think the right fix is to change the documentation.

@bgrant0607 @smarterclayton

コントリビューターガイド