Fix unstructured metadata accessors to respect omitempty semantics

ObjectMeta has fields with omitempty json tags. This means that when
the fields have zero values, they should not be persisted in the object.

Before this commit, some of the metadata accessors for unstructured
objects did not respect these semantics i.e they would persist a field
even if it had a zero value.

This commit updates the accessors so that the field is removed from the
unstructured object map if it contains a zero value.
This commit is contained in:
Nikhita Raghunath
2018-08-21 11:55:42 +05:30
parent 5d8a79f2e1
commit f69544e87d
4 changed files with 195 additions and 7 deletions

View File

@@ -478,7 +478,6 @@ staging/src/k8s.io/apimachinery/pkg/api/validation/path
staging/src/k8s.io/apimachinery/pkg/apis/config/v1alpha1
staging/src/k8s.io/apimachinery/pkg/apis/meta/fuzzer
staging/src/k8s.io/apimachinery/pkg/apis/meta/internalversion
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1
staging/src/k8s.io/apimachinery/pkg/apis/testapigroup