You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If there is no new version found other than the matched version, we short circuit here, as there is no updated version found in the CRDs
101
-
iflen(newStoredVersions) <=0 {
102
-
// TODO: test?
100
+
// If there is no new version found other than alpha/beta, it means there wasn't a newer version installed/reconciled yet and we short circuit here, as there is no updated version found in the CRDs
returneris.Errorf("it doesn't look like your version of ASO is one that supports deprecating CRD %q, versions %q. Have you upgraded ASO yet?", crd.Name, deprecatedVersions)
vardeprecatedVersionRegexp=regexp.MustCompile(`((v1alpha1api|v1beta)\d{8}(preview)?(storage)?|v1beta1)`) // handcrafted (non-ARM) resources have v1beta1 version
15
-
16
-
// deprecatedVersionsMap is a map of crd name to a collection of deprecated versions
// CompareVersions compares two group version strings, for example: v1api20230101preview, v1api20220101, v20220101, v1api20220101storage, and v20220101storage
55
+
// and returns -1 if a < b, 0 if a == b, and 1 if a > b. The storage suffix is ignored in the comparison.
56
+
// Preview versions are considered less than non-preview versions.
57
+
funcCompareVersions(astring, bstring) int {
58
+
matchA:=versionRegexp.FindStringSubmatch(a)
59
+
matchB:=versionRegexp.FindStringSubmatch(b)
60
+
61
+
ifmatchA==nil||matchB==nil {
62
+
// If either version doesn't match the expected pattern, fall back to string comparison
0 commit comments