Eliminate extraneous label and anno maps.

This commit is contained in:
jregan
2020-12-22 08:37:40 -08:00
parent 8a952a1b26
commit 9ddf0fe304
5 changed files with 10 additions and 26 deletions

View File

@@ -95,6 +95,11 @@ func (r *Resource) MatchesAnnotationSelector(selector string) (bool, error) {
}
func (r *Resource) SetAnnotations(m map[string]string) {
if len(m) == 0 {
// Force field erasure.
r.kunStr.SetAnnotations(nil)
return
}
r.kunStr.SetAnnotations(m)
}
@@ -107,6 +112,11 @@ func (r *Resource) SetGvk(gvk resid.Gvk) {
}
func (r *Resource) SetLabels(m map[string]string) {
if len(m) == 0 {
// Force field erasure.
r.kunStr.SetLabels(nil)
return
}
r.kunStr.SetLabels(m)
}