diff --git a/cloud/services/container/clusters/reconcile.go b/cloud/services/container/clusters/reconcile.go index 54ece2c15..50ecd0cc4 100644 --- a/cloud/services/container/clusters/reconcile.go +++ b/cloud/services/container/clusters/reconcile.go @@ -330,14 +330,31 @@ func (s *Service) checkDiffAndPrepareUpdate(ctx context.Context, existingCluster clusterUpdate := containerpb.ClusterUpdate{} // Release channel desiredReleaseChannel := convertToSdkReleaseChannel(s.scope.GCPManagedControlPlane.Spec.ReleaseChannel) - if existingCluster.ReleaseChannel != nil && desiredReleaseChannel != existingCluster.ReleaseChannel.Channel { - needUpdate = true - log.V(0).Info("release channel changed", - "current", existingCluster.ReleaseChannel.Channel, - "desired", desiredReleaseChannel) + // probably just run converttosdkreleasechannel on existingcluster.releasechannel as well + if existingCluster.ReleaseChannel != nil { + if desiredReleaseChannel != existingCluster.ReleaseChannel.Channel { + needUpdate = true + log.V(0).Info("release channel changed", + "current", existingCluster.ReleaseChannel.Channel, + "desired", desiredReleaseChannel) + } + } else { + if desiredReleaseChannel != containerpb.ReleaseChannel_UNSPECIFIED { + needUpdate = true + log.V(0).Info("release channel changed", + "current", nil, + "desired", desiredReleaseChannel) + } + } + if needUpdate == true { clusterUpdate.DesiredReleaseChannel = &containerpb.ReleaseChannel{ Channel: desiredReleaseChannel, } + updateClusterRequest := containerpb.UpdateClusterRequest{ + Name: s.scope.ClusterFullName(), + Update: &clusterUpdate, + } + return needUpdate, &updateClusterRequest } // Master version if s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion != nil { @@ -350,8 +367,10 @@ func (s *Service) checkDiffAndPrepareUpdate(ctx context.Context, existingCluster } controlPlaneVersion := semver.MustParse(*s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion) - - if len(controlPlaneVersion.Pre) > 0 && existingVersion.EQ(controlPlaneVersion) { + if len(controlPlaneVersion.Pre) > 0 && existingVersion.LT(controlPlaneVersion) { + log.V(0).Info("pre-release version detected", + "current", existingVersion, + "desired", controlPlaneVersion) needUpdate = true } else { if controlPlaneVersion.FinalizeVersion() != existingVersion.FinalizeVersion() { diff --git a/cloud/services/container/nodepools/reconcile.go b/cloud/services/container/nodepools/reconcile.go index 9515ef475..fe0251220 100644 --- a/cloud/services/container/nodepools/reconcile.go +++ b/cloud/services/container/nodepools/reconcile.go @@ -341,10 +341,16 @@ func (s *Service) checkDiffAndPrepareUpdateVersionOrImage(existingNodePool *cont existingVersion := semver.MustParse(existingNodePool.Version) nodePoolVersion := semver.MustParse(*s.scope.NodePoolVersion()) - if len(nodePoolVersion.Pre) > 0 && existingVersion.EQ(nodePoolVersion) { + if len(nodePoolVersion.Pre) > 0 && existingVersion.LT(nodePoolVersion) { + log.V(0).Info("pre-release version detected", + "current", existingVersion, + "desired", nodePoolVersion) needUpdate = true } else { if nodePoolVersion.FinalizeVersion() != existingVersion.FinalizeVersion() { + log.V(0).Info("no pre-release version detected", + "current", existingVersion, + "desired", nodePoolVersion) needUpdate = true } } diff --git a/go.mod b/go.mod index d85581c0d..ab3511020 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-gcp go 1.22 +toolchain go1.22.4 + require ( cloud.google.com/go/compute v1.21.0 cloud.google.com/go/container v1.22.1