From 4ccd2f14ebc82a6e69c542faffeaae64804a8ecf Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Mon, 5 Mar 2018 12:13:02 -0800 Subject: [PATCH] Workload endpoints: bug fix for publicEndpoints when annotation is nil --- mapper/workload.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mapper/workload.go b/mapper/workload.go index c5c3e375..09605fd6 100644 --- a/mapper/workload.go +++ b/mapper/workload.go @@ -12,10 +12,10 @@ type WorkloadAnnotations struct { func (n WorkloadAnnotations) FromInternal(data map[string]interface{}) { v, ok := values.RemoveValue(data, "workloadAnnotations", "field.cattle.io/publicEndpoints") if ok { - annotations := convert.ToMapInterface(data["annotations"]) - if annotations == nil { - annotations = map[string]interface{}{} + if _, ok := data["annotations"]; !ok { + data["annotations"] = map[string]interface{}{} } + annotations := convert.ToMapInterface(data["annotations"]) annotations["field.cattle.io/publicEndpoints"] = v } }