From 281df61ef8c6301beff8d3ac19cea6621f2b289f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elvira=20Garc=C3=ADa?= Date: Mon, 5 Feb 2024 12:48:58 +0100 Subject: [PATCH] Add AddLabel()/AddAnnotation() for Route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Elvira GarcĂ­a --- modules/common/route/route.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/common/route/route.go b/modules/common/route/route.go index d9d19e44..07b9579d 100644 --- a/modules/common/route/route.go +++ b/modules/common/route/route.go @@ -189,3 +189,20 @@ func (r *Route) Delete( return nil } + +// AddAnnotation - Adds annotation and merges it with the current set +func (r *Route) addAnnotation(anno map[string]string) { + if r.EmbeddedLabelsAnnotations == nil { + r.EmbeddedLabelsAnnotations = &EmbededLabelsAnnotations{} + } + r.Annotations = util.MergeMaps(r.Annotations, anno) +} + + +// AddLabel - Adds annotation and merges it with the current set +func (r *Route) addLabel(label map[string]string) { + if r.EmbeddedLabelsAnnotations == nil { + r.EmbeddedLabelsAnnotations = &EmbededLabelsAnnotations{} + } + r.Labels = util.MergeMaps(r.Labels, label) +}