From 8d7b1055bb36c63b2990ea2d593d30b098574673 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 19 Oct 2023 17:41:03 -0600 Subject: [PATCH] include a prefix on the label --- pkg/helmvm/helmvm_node.go | 3 ++- pkg/helmvm/node_join.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/helmvm/helmvm_node.go b/pkg/helmvm/helmvm_node.go index 039c3783ef..a9b17f497e 100644 --- a/pkg/helmvm/helmvm_node.go +++ b/pkg/helmvm/helmvm_node.go @@ -5,6 +5,7 @@ import ( "fmt" "math" "strconv" + "strings" "github.com/replicatedhq/kots/pkg/helmvm/types" "github.com/replicatedhq/kots/pkg/k8sutil" @@ -148,7 +149,7 @@ func nodeRolesFromLabels(labels map[string]string) []string { } return nil } - numRoles, err := strconv.Atoi(numRolesStr) + numRoles, err := strconv.Atoi(strings.TrimPrefix(numRolesStr, "total-")) if err != nil { fmt.Printf("failed to parse role label %q: %s", numRolesStr, err.Error()) diff --git a/pkg/helmvm/node_join.go b/pkg/helmvm/node_join.go index 7eca6e2374..9ef7840a4e 100644 --- a/pkg/helmvm/node_join.go +++ b/pkg/helmvm/node_join.go @@ -329,7 +329,7 @@ func getRoleNodeLabels(ctx context.Context, client kubernetes.Interface, role st // one label will be the number of roles, and then deterministic label names will be used to store the role names func getRoleListLabels(roles []string) []string { toReturn := []string{} - toReturn = append(toReturn, fmt.Sprintf("%s:%d", types.EMBEDDED_CLUSTER_ROLE_LABEL, len(roles))) + toReturn = append(toReturn, fmt.Sprintf("%s:total-%d", types.EMBEDDED_CLUSTER_ROLE_LABEL, len(roles))) for idx, role := range roles { toReturn = append(toReturn, fmt.Sprintf("%s-%d:%s", types.EMBEDDED_CLUSTER_ROLE_LABEL, idx, role))