Skip to content

Commit

Permalink
include a prefix on the label
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Oct 19, 2023
1 parent 4ec84dc commit 8d7b105
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/helmvm/helmvm_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"math"
"strconv"
"strings"

"github.com/replicatedhq/kots/pkg/helmvm/types"
"github.com/replicatedhq/kots/pkg/k8sutil"
Expand Down Expand Up @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion pkg/helmvm/node_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 8d7b105

Please sign in to comment.