@@ -1026,15 +1026,21 @@ func (t *Test) runCommandFunc(nodes option.NodeListOption, cmd string) stepFunc
1026
1026
// ARM64 builds are only available on v22.2.0+.
1027
1027
func (t * Test ) chooseUpgradePath () ([]* clusterupgrade.Version , error ) {
1028
1028
skipVersions := t .prng .Float64 () < t .options .skipVersionProbability
1029
+ numUpgrades := t .numUpgrades ()
1030
+ currentVersion := clusterupgrade .CurrentVersion ()
1031
+
1029
1032
isAvailable := func (v * clusterupgrade.Version ) bool {
1030
1033
if t .clusterArch () != vm .ArchARM64 {
1031
1034
return true
1032
1035
}
1033
1036
1034
1037
return v .AtLeast (minSupportedARM64Version )
1035
1038
}
1039
+ isOlderThanMinimumBootstrapVersion := func (v * clusterupgrade.Version ) bool {
1040
+ return t .options .minimumBootstrapVersion != nil && v .LessThan (t .options .minimumBootstrapVersion )
1041
+ }
1036
1042
1037
- var numSkips int
1043
+ forceSkipVersion := true
1038
1044
// possiblePredecessorsFor returns a list of possible predecessors
1039
1045
// for the given release `v`. If skip-version is enabled and
1040
1046
// supported, this function will return both the immediate
@@ -1047,6 +1053,12 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1047
1053
return nil , err
1048
1054
}
1049
1055
1056
+ // If the predecessor is older than the minimum bootstrap version,
1057
+ // then it is not a legal predecessor.
1058
+ if isOlderThanMinimumBootstrapVersion (pred ) {
1059
+ return nil , nil
1060
+ }
1061
+
1050
1062
if ! isAvailable (pred ) {
1051
1063
return nil , nil
1052
1064
}
@@ -1062,12 +1074,18 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1062
1074
return nil , err
1063
1075
}
1064
1076
1077
+ // If the skip upgrade predecessor is older than the minimum bootstrap version,
1078
+ // then it is not a legal predecessor.
1079
+ if isOlderThanMinimumBootstrapVersion (predPred ) {
1080
+ return []* clusterupgrade.Version {pred }, nil
1081
+ }
1082
+
1065
1083
// If we haven't performed a skip-version upgrade yet, do it. This logic
1066
1084
// makes sure that, when skip-version upgrades are enabled, it happens
1067
1085
// when upgrading to the current release, which is the most important
1068
1086
// upgrade to be tested on any release branch.
1069
- if numSkips == 0 {
1070
- numSkips ++
1087
+ if forceSkipVersion {
1088
+ forceSkipVersion = false
1071
1089
return []* clusterupgrade.Version {predPred }, nil
1072
1090
}
1073
1091
@@ -1078,7 +1096,7 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1078
1096
1079
1097
// possibleUpgradePathsMap maps a version to the possible upgrade paths that
1080
1098
// can be taken with exactly n upgrades.
1081
- possibleUpgradePathsMap := make (map [* clusterupgrade. Version ]map [int ][][]* clusterupgrade.Version )
1099
+ possibleUpgradePathsMap := make (map [string ]map [int ][][]* clusterupgrade.Version )
1082
1100
// findPossibleUpgradePaths finds all legal upgrade paths ending at version `v` with
1083
1101
// exactly `numUpgrades` upgrades.
1084
1102
var findPossibleUpgradePaths func (v * clusterupgrade.Version , numUpgrades int ) ([][]* clusterupgrade.Version , error )
@@ -1088,9 +1106,9 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1088
1106
return [][]* clusterupgrade.Version {{v }}, nil
1089
1107
}
1090
1108
// Check if we have already computed the possible upgrade paths for this version.
1091
- if _ , ok := possibleUpgradePathsMap [v ]; ! ok {
1092
- possibleUpgradePathsMap [v ] = make (map [int ][][]* clusterupgrade.Version )
1093
- } else if paths , ok := possibleUpgradePathsMap [v ][numUpgrades ]; ok {
1109
+ if _ , ok := possibleUpgradePathsMap [v . String () ]; ! ok {
1110
+ possibleUpgradePathsMap [v . String () ] = make (map [int ][][]* clusterupgrade.Version )
1111
+ } else if paths , ok := possibleUpgradePathsMap [v . String () ][numUpgrades ]; ok {
1094
1112
return paths , nil
1095
1113
}
1096
1114
@@ -1103,11 +1121,6 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1103
1121
return nil , err
1104
1122
}
1105
1123
for _ , pred := range predecessors {
1106
- // If the predecessor is older than the minimum bootstrapped version, then
1107
- // it's not a legal upgrade path.
1108
- if t .options .minimumBootstrapVersion != nil && pred .LessThan (t .options .minimumBootstrapVersion ) {
1109
- continue
1110
- }
1111
1124
predPaths , err := findPossibleUpgradePaths (pred , numUpgrades - 1 )
1112
1125
if err != nil {
1113
1126
return nil , err
@@ -1117,13 +1130,11 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1117
1130
}
1118
1131
}
1119
1132
1120
- possibleUpgradePathsMap [v ][numUpgrades ] = paths
1133
+ possibleUpgradePathsMap [v . String () ][numUpgrades ] = paths
1121
1134
return paths , nil
1122
1135
}
1123
1136
1124
- currentVersion := clusterupgrade .CurrentVersion ()
1125
1137
var upgradePath []* clusterupgrade.Version
1126
- numUpgrades := t .numUpgrades ()
1127
1138
1128
1139
// Best effort to find a valid upgrade path with exactly numUpgrades. If one is
1129
1140
// not found because some release is not available for the cluster architecture,
@@ -1141,13 +1152,21 @@ func (t *Test) chooseUpgradePath() ([]*clusterupgrade.Version, error) {
1141
1152
upgradePath = possibleUpgradePaths [t .prng .Intn (len (possibleUpgradePaths ))]
1142
1153
break
1143
1154
}
1155
+ forceSkipVersion = true
1144
1156
}
1145
1157
1146
- if len (upgradePath ) < numUpgrades {
1147
- if t .clusterArch () != vm .ArchARM64 {
1158
+ if len (upgradePath ) < (numUpgrades + 1 ) {
1159
+ warnMsg := "WARNING: %d upgrades requested but found plan with only %d upgrades"
1160
+ if skipVersions {
1161
+ t .logger .Printf ("%s: prioritizing running at least one skip version upgrade" , warnMsg )
1162
+ } else if t .clusterArch () == vm .ArchARM64 {
1163
+ t .logger .Printf ("%s: ARM64 is only supported on %s+" , warnMsg , minSupportedARM64Version )
1164
+ } else {
1148
1165
return nil , errors .Newf ("unable to find a valid upgrade path with %d upgrades" , numUpgrades )
1149
1166
}
1150
- t .logger .Printf ("WARNING: skipping upgrades as ARM64 is only supported on %s+" , minSupportedARM64Version )
1167
+ }
1168
+ if skipVersions && forceSkipVersion {
1169
+ t .logger .Printf ("WARNING: skip version upgrades were enabled but were not performed because the minimum supported or bootstrap version did not allow" )
1151
1170
}
1152
1171
return upgradePath , nil
1153
1172
}
0 commit comments