From 4b9844f5c3136f4f2c410fe236cbb2846f0ced8c Mon Sep 17 00:00:00 2001 From: Maxwell Jiang Date: Tue, 31 May 2022 01:34:56 -0500 Subject: [PATCH] the specific configmap/secret name can be regexp-ly selected --- internal/pkg/handler/upgrade.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/pkg/handler/upgrade.go b/internal/pkg/handler/upgrade.go index f89683ad..fa735cad 100644 --- a/internal/pkg/handler/upgrade.go +++ b/internal/pkg/handler/upgrade.go @@ -13,6 +13,7 @@ import ( "github.com/stakater/Reloader/internal/pkg/util" "github.com/stakater/Reloader/pkg/kube" v1 "k8s.io/api/core/v1" + "regexp" "strconv" "strings" ) @@ -154,8 +155,9 @@ func PerformRollingUpgrade(clients kube.Clients, config util.Config, upgradeFunc if result != constants.Updated && annotationValue != "" { values := strings.Split(annotationValue, ",") for _, value := range values { - value = strings.Trim(value, " ") - if value == config.ResourceName { + value = strings.TrimSpace(value) + re := regexp.MustCompile("^" + value + "$") + if re.Match([]byte(config.ResourceName)) { result = invokeReloadStrategy(upgradeFuncs, i, config, false) if result == constants.Updated { break