Update dependency go modules for k8s v1.29.0-rc.1

This commit is contained in:
Sunny Song
2023-11-29 21:37:58 +00:00
parent cdbbb78ff8
commit 7603bf1c4e
246 changed files with 10181 additions and 13197 deletions

View File

@@ -18,6 +18,7 @@ package version
import (
"bytes"
"errors"
"fmt"
"regexp"
"strconv"
@@ -85,6 +86,47 @@ func parse(str string, semver bool) (*Version, error) {
return v, nil
}
// HighestSupportedVersion returns the highest supported version
// This function assumes that the highest supported version must be v1.x.
func HighestSupportedVersion(versions []string) (*Version, error) {
if len(versions) == 0 {
return nil, errors.New("empty array for supported versions")
}
var (
highestSupportedVersion *Version
theErr error
)
for i := len(versions) - 1; i >= 0; i-- {
currentHighestVer, err := ParseGeneric(versions[i])
if err != nil {
theErr = err
continue
}
if currentHighestVer.Major() > 1 {
continue
}
if highestSupportedVersion == nil || highestSupportedVersion.LessThan(currentHighestVer) {
highestSupportedVersion = currentHighestVer
}
}
if highestSupportedVersion == nil {
return nil, fmt.Errorf(
"could not find a highest supported version from versions (%v) reported: %+v",
versions, theErr)
}
if highestSupportedVersion.Major() != 1 {
return nil, fmt.Errorf("highest supported version reported is %v, must be v1.x", highestSupportedVersion)
}
return highestSupportedVersion, nil
}
// ParseGeneric parses a "generic" version string. The version string must consist of two
// or more dot-separated numeric fields (the first of which can't have leading zeroes),
// followed by arbitrary uninterpreted data (which need not be separated from the final