From 7dffd8dde7a7249c4ac1aa30dedc64d82b7d46d5 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 19 Oct 2023 15:51:23 -0600 Subject: [PATCH] handle having no labels on the first node --- pkg/helmvm/helmvm_node.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/helmvm/helmvm_node.go b/pkg/helmvm/helmvm_node.go index 5056b1b68b..74883c6d09 100644 --- a/pkg/helmvm/helmvm_node.go +++ b/pkg/helmvm/helmvm_node.go @@ -147,6 +147,12 @@ func nodeRolesFromLabels(labels map[string]string) []string { numRoles, err := strconv.Atoi(numRolesStr) if err != nil { fmt.Printf("failed to parse role label %q: %s", numRolesStr, err.Error()) + + // the first node will not initially have a role label, but is a 'controller' + if val, ok := labels["node-role.kubernetes.io/control-plane"]; ok && val == "true" { + return []string{"controller"} + } + return nil }