From 8bb1420c4c54341c5815dc46c7063528f408258f Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Tue, 8 Aug 2023 12:07:19 +0800 Subject: [PATCH] fix: wrong variable ref Signed-off-by: Lin Yang --- controllers/flb/service_controller.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/flb/service_controller.go b/controllers/flb/service_controller.go index fdd17cd3..efa31471 100644 --- a/controllers/flb/service_controller.go +++ b/controllers/flb/service_controller.go @@ -615,9 +615,8 @@ func (r *ServiceReconciler) getTags(svc *corev1.Service) string { return "" } - var tagsBytes []byte tags := make([]serviceTag, 0) - if err := yaml.Unmarshal(tagsBytes, &tags); err != nil { + if err := yaml.Unmarshal([]byte(rawTags), &tags); err != nil { klog.Errorf("Failed to unmarshal tags: %s, it' not in a valid format", err) defer r.Recorder.Eventf(svc, corev1.EventTypeWarning, "InvalidTagFormat", "Format of annotation %s is not valid", commons.FlbTagsAnnotation) return ""