diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index ce0f8e8a7aa..dc19bd09eb7 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -86370,7 +86370,7 @@ "type": "string" }, "versionPriority": { - "description": "VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) Since it's inside of a group, the number can be small, probably in the 10s.", + "description": "VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). Since it's inside of a group, the number can be small, probably in the 10s. In case of equal version priorities, the version string will be used to compute the order inside a group. If the version string is \"kube-like\", it will sort above non \"kube-like\" version strings, which are ordered lexicographically. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA \u003e beta \u003e alpha, and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.", "type": "integer", "format": "int32" } @@ -86515,7 +86515,7 @@ "type": "string" }, "versionPriority": { - "description": "VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) Since it's inside of a group, the number can be small, probably in the 10s.", + "description": "VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). Since it's inside of a group, the number can be small, probably in the 10s. In case of equal version priorities, the version string will be used to compute the order inside a group. If the version string is \"kube-like\", it will sort above non \"kube-like\" version strings, which are ordered lexicographically. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA \u003e beta \u003e alpha, and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.", "type": "integer", "format": "int32" } diff --git a/staging/src/k8s.io/apimachinery/pkg/version/BUILD b/staging/src/k8s.io/apimachinery/pkg/version/BUILD index bdccf7b3a7a..fc803ec6f37 100644 --- a/staging/src/k8s.io/apimachinery/pkg/version/BUILD +++ b/staging/src/k8s.io/apimachinery/pkg/version/BUILD @@ -3,12 +3,14 @@ package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", + "go_test", ) go_library( name = "go_default_library", srcs = [ "doc.go", + "helpers.go", "types.go", ], importpath = "k8s.io/apimachinery/pkg/version", @@ -26,3 +28,9 @@ filegroup( srcs = [":package-srcs"], tags = ["automanaged"], ) + +go_test( + name = "go_default_test", + srcs = ["helpers_test.go"], + embed = [":go_default_library"], +) diff --git a/staging/src/k8s.io/apimachinery/pkg/version/helpers_test.go b/staging/src/k8s.io/apimachinery/pkg/version/helpers_test.go index b473eae0ebc..863a53697d4 100644 --- a/staging/src/k8s.io/apimachinery/pkg/version/helpers_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/version/helpers_test.go @@ -36,7 +36,7 @@ func TestCompareKubeAwareVersionStrings(t *testing.T) { {"v1beta10", "v1beta2", true}, {"foo", "v1beta2", false}, {"bar", "foo", true}, - {"version1", "version2", true}, // Non kube-like versions are sorted alphabetically + {"version1", "version2", true}, // Non kube-like versions are sorted alphabetically {"version1", "version10", true}, // Non kube-like versions are sorted alphabetically } diff --git a/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/BUILD b/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/BUILD index e4bbd5d0024..a9ad38c7ae0 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/BUILD +++ b/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/BUILD @@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", + "go_test", ) go_library( @@ -19,6 +20,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/version:go_default_library", ], ) @@ -40,3 +42,9 @@ filegroup( ], tags = ["automanaged"], ) + +go_test( + name = "go_default_test", + srcs = ["helpers_test.go"], + embed = [":go_default_library"], +) diff --git a/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto b/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto index b00a12e51c5..e983874efd2 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto +++ b/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/generated.proto @@ -102,8 +102,13 @@ message APIServiceSpec { // VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. // The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). - // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) // Since it's inside of a group, the number can be small, probably in the 10s. + // In case of equal version priorities, the version string will be used to compute the order inside a group. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha, and then by comparing major version, then minor version. An example sorted list of + // versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. optional int32 versionPriority = 8; } diff --git a/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1/generated.proto b/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1/generated.proto index 13c1126dd6c..77fba8effb0 100644 --- a/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1/generated.proto +++ b/staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1/generated.proto @@ -102,8 +102,13 @@ message APIServiceSpec { // VersionPriority controls the ordering of this API version inside of its group. Must be greater than zero. // The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). - // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) // Since it's inside of a group, the number can be small, probably in the 10s. + // In case of equal version priorities, the version string will be used to compute the order inside a group. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha, and then by comparing major version, then minor version. An example sorted list of + // versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. optional int32 versionPriority = 8; }