Skip to content

Commit

Permalink
Fix node pool update when version is set
Browse files Browse the repository at this point in the history
  • Loading branch information
kahun committed Dec 12, 2023
1 parent 15c6f8f commit b8ac10c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cloud/services/container/nodepools/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"reflect"
"strings"

"sigs.k8s.io/cluster-api-provider-gcp/cloud"
"sigs.k8s.io/cluster-api-provider-gcp/util/resourceurl"
Expand Down Expand Up @@ -335,9 +336,12 @@ func (s *Service) checkDiffAndPrepareUpdateNodePool(existingNodePool *containerp
Name: s.scope.NodePoolFullName(),
}
// Node version
if s.scope.NodePoolVersion() != nil && *s.scope.NodePoolVersion() != existingNodePool.Version {
needUpdate = true
updateNodePoolRequest.NodeVersion = *s.scope.NodePoolVersion()
if s.scope.NodePoolVersion() != nil {
desiredNodePoolVersion := strings.Replace(*s.scope.NodePoolVersion(), "v", "", 1)
if desiredNodePoolVersion != existingNodePool.Version {
needUpdate = true
updateNodePoolRequest.NodeVersion = desiredNodePoolVersion
}
}
// Kubernetes labels
if !cmp.Equal(map[string]string(s.scope.GCPManagedMachinePool.Spec.KubernetesLabels), existingNodePool.Config.Labels) {
Expand Down

0 comments on commit b8ac10c

Please sign in to comment.