From fe7615afb4e941c145f7c2a24b953ef0defd4977 Mon Sep 17 00:00:00 2001 From: Somtochi Onyekwere Date: Mon, 7 Feb 2022 11:30:21 +0100 Subject: [PATCH 1/2] Update matchLabels in LabelSelectors Signed-off-by: Somtochi Onyekwere --- pkg/canary/deployment_controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/canary/deployment_controller.go b/pkg/canary/deployment_controller.go index e6e990f0..d0e1bd1a 100644 --- a/pkg/canary/deployment_controller.go +++ b/pkg/canary/deployment_controller.go @@ -489,6 +489,11 @@ func (c *DeploymentController) appendPrimarySuffixToValuesIfNeeded(labelSelector } } } + for key, value := range labelSelector.MatchLabels { + if contains(c.labels, key) { + labelSelector.MatchLabels[key] = value + "-primary" + } + } } } From 08b1e5227801b3cd89c17d97201da431cac50832 Mon Sep 17 00:00:00 2001 From: Somtochi Onyekwere Date: Mon, 7 Feb 2022 13:00:43 +0100 Subject: [PATCH 2/2] Add extra check for name Signed-off-by: Somtochi Onyekwere --- pkg/canary/deployment_controller.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/canary/deployment_controller.go b/pkg/canary/deployment_controller.go index d0e1bd1a..d737b201 100644 --- a/pkg/canary/deployment_controller.go +++ b/pkg/canary/deployment_controller.go @@ -489,9 +489,12 @@ func (c *DeploymentController) appendPrimarySuffixToValuesIfNeeded(labelSelector } } } + for key, value := range labelSelector.MatchLabels { if contains(c.labels, key) { - labelSelector.MatchLabels[key] = value + "-primary" + if value == canaryDep.Name { + labelSelector.MatchLabels[key] = value + "-primary" + } } } }