Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cloud/services/container/nodepools/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,12 @@ func (s *Service) checkDiffAndPrepareUpdateConfig(existingNodePool *containerpb.
desiredNodePool := scope.ConvertToSdkNodePool(*s.scope.GCPManagedMachinePool, *s.scope.MachinePool, isRegional, s.scope.GCPManagedControlPlane.Spec.ClusterName)

// Node version
if s.scope.NodePoolVersion() != nil && *s.scope.NodePoolVersion() != infrav1exp.ConvertFromSdkNodeVersion(existingNodePool.Version) {
needUpdate = true
updateNodePoolRequest.NodeVersion = *s.scope.NodePoolVersion()
if s.scope.NodePoolVersion() != nil {
desiredNodePoolVersion := infrav1exp.ConvertFromSdkNodeVersion(*s.scope.NodePoolVersion())
if desiredNodePoolVersion != infrav1exp.ConvertFromSdkNodeVersion(existingNodePool.Version) {
needUpdate = true
updateNodePoolRequest.NodeVersion = desiredNodePoolVersion
}
}
// Kubernetes labels
if !cmp.Equal(desiredNodePool.Config.GetLabels(), existingNodePool.Config.Labels) {
Expand Down
2 changes: 1 addition & 1 deletion exp/api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ func ConvertToSdkAutoscaling(autoscaling *NodePoolAutoScaling) *containerpb.Node
// ConvertFromSdkNodeVersion converts GCP SDK node version to k8s version.
func ConvertFromSdkNodeVersion(sdkNodeVersion string) string {
// For example, the node version returned from GCP SDK can be 1.27.2-gke.2100, we want to convert it to 1.27.2
return strings.Split(sdkNodeVersion, "-")[0]
return strings.Replace(strings.Split(sdkNodeVersion, "-")[0], "v", "", 1)
}