From 525391e363a2c7465af255344eb3a5c68cb6e473 Mon Sep 17 00:00:00 2001 From: kun zhou Date: Thu, 4 Apr 2024 10:07:00 -0700 Subject: [PATCH 1/9] PCP-2769: upgrade golang build version to 1.22 upgrade golang build version to 1.22 in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 565d55d45..0ac391706 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ PROD_REGISTRY := registry.k8s.io/cluster-api-gcp IMAGE_NAME ?= cluster-api-gcp-controller FIPS_ENABLE ?= "" -BUILDER_GOLANG_VERSION ?= 1.21 +BUILDER_GOLANG_VERSION ?= 1.22 BUILD_ARGS = --build-arg CRYPTO_LIB=${FIPS_ENABLE} --build-arg BUILDER_GOLANG_VERSION=${BUILDER_GOLANG_VERSION} RELEASE_LOC := release From 2be4bf6868d92eb8d099c0602f1bbca521d0719d Mon Sep 17 00:00:00 2001 From: kun zhou Date: Thu, 4 Apr 2024 11:52:57 -0700 Subject: [PATCH 2/9] upgrade x/net to 0.23.0 --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 1691f2cd9..5b0f3092a 100644 --- a/go.mod +++ b/go.mod @@ -17,9 +17,9 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.2 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.21.0 golang.org/x/mod v0.9.0 - golang.org/x/net v0.17.0 + golang.org/x/net v0.23.0 google.golang.org/api v0.126.0 google.golang.org/grpc v1.58.3 k8s.io/api v0.25.5 @@ -120,9 +120,9 @@ require ( go.uber.org/zap v1.21.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect golang.org/x/tools v0.7.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect diff --git a/go.sum b/go.sum index f6d6d7dbe..bdc6ce329 100644 --- a/go.sum +++ b/go.sum @@ -627,8 +627,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -722,8 +722,8 @@ golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -845,13 +845,13 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -863,8 +863,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From ca4f33e4fc60c47a81a0d3ca6a9343b55bb04f08 Mon Sep 17 00:00:00 2001 From: kun zhou Date: Sun, 21 Apr 2024 23:28:44 -0700 Subject: [PATCH 3/9] update google.golang.org/protobuf@v1.33.0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5b0f3092a..9b3a1b149 100644 --- a/go.mod +++ b/go.mod @@ -130,7 +130,7 @@ require ( google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect diff --git a/go.sum b/go.sum index bdc6ce329..cfeda0470 100644 --- a/go.sum +++ b/go.sum @@ -1127,8 +1127,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From b3e5a62555df214821f1fb127c967b9bf222f8b5 Mon Sep 17 00:00:00 2001 From: kun zhou Date: Tue, 23 Apr 2024 11:14:56 -0700 Subject: [PATCH 4/9] update golang version to 1.22 in go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 9b3a1b149..d85581c0d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module sigs.k8s.io/cluster-api-provider-gcp -go 1.21 +go 1.22 require ( cloud.google.com/go/compute v1.21.0 From afb22f06bddd189b12497777ce77c6a853227a51 Mon Sep 17 00:00:00 2001 From: kun zhou Date: Tue, 23 Apr 2024 22:40:28 -0700 Subject: [PATCH 5/9] PCP-2769-fix: add toolchain go1.22.2 add toolchain go1.22.2 in go.mod --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index d85581c0d..75f1c1aa9 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.2 + require ( cloud.google.com/go/compute v1.21.0 cloud.google.com/go/container v1.22.1 From 7feadc1187559d591f5571ed5fceeebefb53dd03 Mon Sep 17 00:00:00 2001 From: Jayesh Srivastava Date: Thu, 27 Jun 2024 15:22:37 +0530 Subject: [PATCH 6/9] PCP-3115: Bump go version (#231) --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 75f1c1aa9..ab3511020 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module sigs.k8s.io/cluster-api-provider-gcp go 1.22 -toolchain go1.22.2 +toolchain go1.22.4 require ( cloud.google.com/go/compute v1.21.0 From 9f2937487185cb133cdbad4ea807fcbf09c3b7a9 Mon Sep 17 00:00:00 2001 From: Richard Su Date: Sun, 4 Aug 2024 19:18:03 -0700 Subject: [PATCH 7/9] Fixed a bug causing clusters to endlessly have updates triggered if their controlplaneversion had a pre-release version. --- cloud/services/container/clusters/reconcile.go | 5 ++++- cloud/services/container/nodepools/reconcile.go | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cloud/services/container/clusters/reconcile.go b/cloud/services/container/clusters/reconcile.go index 54ece2c15..e8728e9d7 100644 --- a/cloud/services/container/clusters/reconcile.go +++ b/cloud/services/container/clusters/reconcile.go @@ -351,7 +351,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 } } From 85e1ca4004f60614fa3ec49e6ac0750f7436ebc1 Mon Sep 17 00:00:00 2001 From: Richard Su Date: Wed, 7 Aug 2024 15:41:21 -0700 Subject: [PATCH 8/9] Prioritize release channel update to prevent updating two fields at once --- cloud/services/container/clusters/reconcile.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cloud/services/container/clusters/reconcile.go b/cloud/services/container/clusters/reconcile.go index e8728e9d7..ed2dd1141 100644 --- a/cloud/services/container/clusters/reconcile.go +++ b/cloud/services/container/clusters/reconcile.go @@ -338,6 +338,11 @@ func (s *Service) checkDiffAndPrepareUpdate(ctx context.Context, existingCluster 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,7 +355,6 @@ func (s *Service) checkDiffAndPrepareUpdate(ctx context.Context, existingCluster } controlPlaneVersion := semver.MustParse(*s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion) - if len(controlPlaneVersion.Pre) > 0 && existingVersion.LT(controlPlaneVersion) { log.V(0).Info("pre-release version detected", "current", existingVersion, From ffaf24b2d5a7c9a118ec70b7d7c4ed82717db153 Mon Sep 17 00:00:00 2001 From: Richard Su Date: Thu, 8 Aug 2024 22:52:02 -0700 Subject: [PATCH 9/9] Code change to update release channel when existing release channel is nil (none/static). --- .../services/container/clusters/reconcile.go | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/cloud/services/container/clusters/reconcile.go b/cloud/services/container/clusters/reconcile.go index ed2dd1141..50ecd0cc4 100644 --- a/cloud/services/container/clusters/reconcile.go +++ b/cloud/services/container/clusters/reconcile.go @@ -330,11 +330,23 @@ 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, }