Skip to content

Commit bbae3d9

Browse files
authored
test: fix the autobursting detection (#1443)
Bursting on Autopilot requires clusters to meet the following conditions: - You originally created the cluster with GKE version 1.26 or later. - The cluster is running GKE version 1.30.2-gke.1394000 or later. When upgrading an Autopilot cluster to a supported version, GKE upgrades the worker nodes to match the control plane version over time. A control plane restart is required to enable bursting, and must happen after all the nodes run a supported version. There isn't a good way to check the control plane restart, this commit only guarantees that all node versions are 1.30.2-gke.1394000 or later when nt.ClusterSupportsBursting is true. Link: https://cloud.google.com/kubernetes-engine/docs/how-to/pod-bursting-gke#availability-in-gke b/369006133 b/370402111
1 parent 162c615 commit bbae3d9

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

e2e/nomostest/new.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func SharedTestEnv(t nomostesting.NTB, opts *ntopts.New) *NT {
183183
OCIClient: sharedNt.OCIClient,
184184
}
185185

186-
t.Logf("using shared test env: %s, cluster version: %s, cluster hash: %s", sharedNt.ClusterName, nt.ClusterVersion, nt.ClusterHash)
186+
t.Logf("using shared test env: %s, cluster version: %s, cluster hash: %s, support bursting: %t", nt.ClusterName, nt.ClusterVersion, nt.ClusterHash, nt.ClusterSupportsBursting)
187187

188188
if opts.SkipConfigSyncInstall {
189189
return nt

e2e/nomostest/nt.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,27 @@ func (nt *NT) autopilotClusterSupportsBursting() (bool, error) {
906906
return false, err
907907
}
908908
minInitialVersion := clusterversion.ClusterVersion{Major: 1, Minor: 26}
909-
minCurrentVersion := clusterversion.ClusterVersion{
910-
Major: 1, Minor: 30, Patch: 2, Suffix: "-gke.1394000"}
911-
return initialClusterVersion.IsAtLeast(minInitialVersion) &&
912-
nt.ClusterVersion.IsAtLeast(minCurrentVersion), nil
909+
if !initialClusterVersion.IsAtLeast(minInitialVersion) {
910+
return false, nil
911+
}
912+
913+
minCurrentVersion := clusterversion.ClusterVersion{Major: 1, Minor: 30, Patch: 2, Suffix: "-gke.1394000"}
914+
args = []string{"get", "nodes", "-o", `jsonpath={.items[*].status.nodeInfo.kubeletVersion}`}
915+
out, err = nt.Shell.Kubectl(args...)
916+
if err != nil {
917+
return false, err
918+
}
919+
versions := strings.Split(strings.TrimSpace(string(out)), " ")
920+
for _, nodeVersion := range versions {
921+
v, err := clusterversion.ParseClusterVersion(nodeVersion)
922+
if err != nil {
923+
return false, err
924+
}
925+
if !v.IsAtLeast(minCurrentVersion) {
926+
return false, nil
927+
}
928+
}
929+
return true, nil
913930
}
914931

915932
func (nt *NT) detectClusterSupportsBursting() {

0 commit comments

Comments
 (0)