Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCP-3237 #241

Open
wants to merge 12 commits into
base: ft-PCP-2884
Choose a base branch
from
Open
33 changes: 26 additions & 7 deletions cloud/services/container/clusters/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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() {
Expand Down
8 changes: 7 additions & 1 deletion cloud/services/container/nodepools/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading