add group priority to apiservice

This commit is contained in:
deads2k 2017-06-01 16:32:27 -04:00
parent 85832892b1
commit d13ad28420
13 changed files with 223 additions and 147 deletions

View File

@ -46746,7 +46746,8 @@
"required": [ "required": [
"service", "service",
"caBundle", "caBundle",
"priority" "groupPriorityMinimum",
"versionPriority"
], ],
"properties": { "properties": {
"caBundle": { "caBundle": {
@ -46758,15 +46759,15 @@
"description": "Group is the API group name this server hosts", "description": "Group is the API group name this server hosts",
"type": "string" "type": "string"
}, },
"groupPriorityMinimum": {
"description": "GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is prefered by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number 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) We'd recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000s",
"type": "integer",
"format": "int32"
},
"insecureSkipTLSVerify": { "insecureSkipTLSVerify": {
"description": "InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead.", "description": "InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead.",
"type": "boolean" "type": "boolean"
}, },
"priority": {
"description": "Priority controls the ordering of this API group in the overall discovery document that gets served. Client tools like `kubectl` use this ordering to derive preference, so this ordering mechanism is important. Values must be between 1 and 1000 The primary sort is based on priority, ordered lowest number to highest (10 before 20). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) We'd recommend something like: *.k8s.io (except extensions) at 100, extensions at 150 PaaSes (OpenShift, Deis) are recommended to be in the 200s",
"type": "integer",
"format": "int64"
},
"service": { "service": {
"description": "Service is a reference to the service for this API server. It must communicate on port 443 If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be fulfilled.", "description": "Service is a reference to the service for this API server. It must communicate on port 443 If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be fulfilled.",
"$ref": "#/definitions/io.k8s.kube-aggregator.pkg.apis.apiregistration.v1beta1.ServiceReference" "$ref": "#/definitions/io.k8s.kube-aggregator.pkg.apis.apiregistration.v1beta1.ServiceReference"
@ -46774,6 +46775,11 @@
"version": { "version": {
"description": "Version is the API version this server hosts. For example, \"v1\"", "description": "Version is the API version this server hosts. For example, \"v1\"",
"type": "string" "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.",
"type": "integer",
"format": "int32"
} }
} }
}, },

View File

@ -147,9 +147,10 @@ func makeAPIService(gv schema.GroupVersion) *apiregistration.APIService {
return &apiregistration.APIService{ return &apiregistration.APIService{
ObjectMeta: metav1.ObjectMeta{Name: gv.Version + "." + gv.Group}, ObjectMeta: metav1.ObjectMeta{Name: gv.Version + "." + gv.Group},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: gv.Group, Group: gv.Group,
Version: gv.Version, Version: gv.Version,
Priority: 100, GroupPriority: 1000,
VersionPriority: 10,
}, },
} }
} }
@ -180,7 +181,7 @@ func apiServicesToRegister(delegateAPIServer genericapiserver.DelegationTarget,
// but for now its a special case // but for now its a special case
// apps has to come last for compatibility with 1.5 kubectl clients // apps has to come last for compatibility with 1.5 kubectl clients
if apiService.Spec.Group == "apps" { if apiService.Spec.Group == "apps" {
apiService.Spec.Priority = 110 apiService.Spec.GroupPriority = 1100
} }
registration.AddAPIServiceToSync(apiService) registration.AddAPIServiceToSync(apiService)

View File

@ -255,9 +255,10 @@ func (c *tprRegistrationController) handleVersionUpdate(groupVersion schema.Grou
c.apiServiceRegistration.AddAPIServiceToSync(&apiregistration.APIService{ c.apiServiceRegistration.AddAPIServiceToSync(&apiregistration.APIService{
ObjectMeta: metav1.ObjectMeta{Name: apiServiceName}, ObjectMeta: metav1.ObjectMeta{Name: apiServiceName},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: groupVersion.Group, Group: groupVersion.Group,
Version: groupVersion.Version, Version: groupVersion.Version,
Priority: 500, // TPRs should have relatively low priority GroupPriority: 5000, // TPRs should have relatively low priority
VersionPriority: 20, // TPRs should have relatively low priority
}, },
}) })

View File

@ -84,9 +84,10 @@ func TestHandleVersionUpdate(t *testing.T) {
{ {
ObjectMeta: metav1.ObjectMeta{Name: "v1.group.com"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.group.com"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: "group.com", Group: "group.com",
Version: "v1", Version: "v1",
Priority: 500, GroupPriority: 5000,
VersionPriority: 20,
}, },
}, },
}, },
@ -121,9 +122,10 @@ func TestHandleVersionUpdate(t *testing.T) {
{ {
ObjectMeta: metav1.ObjectMeta{Name: "v1.group.com"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.group.com"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: "group.com", Group: "group.com",
Version: "v1", Version: "v1",
Priority: 500, GroupPriority: 5000,
VersionPriority: 20,
}, },
}, },
}, },

View File

@ -23,12 +23,12 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
) )
func SortedByGroup(servers []*APIService) [][]*APIService { func SortedByGroupAndVersion(servers []*APIService) [][]*APIService {
serversByPriority := ByPriority(servers) serversByGroupPriority := ByGroupPriority(servers)
sort.Sort(serversByPriority) sort.Sort(serversByGroupPriority)
ret := [][]*APIService{} ret := [][]*APIService{}
for _, curr := range serversByPriority { for _, curr := range serversByGroupPriority {
// check to see if we already have an entry for this group // check to see if we already have an entry for this group
existingIndex := -1 existingIndex := -1
for j, groupInReturn := range ret { for j, groupInReturn := range ret {
@ -40,6 +40,7 @@ func SortedByGroup(servers []*APIService) [][]*APIService {
if existingIndex >= 0 { if existingIndex >= 0 {
ret[existingIndex] = append(ret[existingIndex], curr) ret[existingIndex] = append(ret[existingIndex], curr)
sort.Sort(ByVersionPriority(ret[existingIndex]))
continue continue
} }
@ -49,15 +50,26 @@ func SortedByGroup(servers []*APIService) [][]*APIService {
return ret return ret
} }
type ByPriority []*APIService type ByGroupPriority []*APIService
func (s ByPriority) Len() int { return len(s) } func (s ByGroupPriority) Len() int { return len(s) }
func (s ByPriority) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s ByGroupPriority) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s ByPriority) Less(i, j int) bool { func (s ByGroupPriority) Less(i, j int) bool {
if s[i].Spec.Priority == s[j].Spec.Priority { if s[i].Spec.GroupPriority != s[j].Spec.GroupPriority {
return s[i].Name < s[j].Name return s[i].Spec.GroupPriority < s[j].Spec.GroupPriority
} }
return s[i].Spec.Priority < s[j].Spec.Priority return s[i].Name < s[j].Name
}
type ByVersionPriority []*APIService
func (s ByVersionPriority) Len() int { return len(s) }
func (s ByVersionPriority) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s ByVersionPriority) Less(i, j int) bool {
if s[i].Spec.VersionPriority != s[j].Spec.VersionPriority {
return s[i].Spec.VersionPriority < s[j].Spec.VersionPriority
}
return s[i].Name < s[j].Name
} }
// APIServiceNameToGroupVersion returns the GroupVersion for a given apiServiceName. The name // APIServiceNameToGroupVersion returns the GroupVersion for a given apiServiceName. The name

View File

@ -53,14 +53,19 @@ type APIServiceSpec struct {
// CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate.
CABundle []byte CABundle []byte
// Priority controls the ordering of this API group in the overall discovery document that gets served. // GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is prefered by clients over lower priority ones.
// Client tools like `kubectl` use this ordering to derive preference, so this ordering mechanism is important. // Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority.
// Values must be between 1 and 1000 // The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10).
// The primary sort is based on priority, ordered lowest number to highest (10 before 20).
// The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo)
// We'd recommend something like: *.k8s.io (except extensions) at 100, extensions at 150 // We'd recommend something like: *.k8s.io (except extensions) at 18000 and
// PaaSes (OpenShift, Deis) are recommended to be in the 200s // PaaSes (OpenShift, Deis) are recommended to be in the 2000s
Priority int64 GroupPriorityMinimum int32
// 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.
VersionPriority int32
} }
type ConditionStatus string type ConditionStatus string

View File

@ -255,9 +255,12 @@ func (m *APIServiceSpec) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintGenerated(dAtA, i, uint64(len(m.CABundle))) i = encodeVarintGenerated(dAtA, i, uint64(len(m.CABundle)))
i += copy(dAtA[i:], m.CABundle) i += copy(dAtA[i:], m.CABundle)
} }
dAtA[i] = 0x30 dAtA[i] = 0x38
i++ i++
i = encodeVarintGenerated(dAtA, i, uint64(m.Priority)) i = encodeVarintGenerated(dAtA, i, uint64(m.GroupPriorityMinimum))
dAtA[i] = 0x40
i++
i = encodeVarintGenerated(dAtA, i, uint64(m.VersionPriority))
return i, nil return i, nil
} }
@ -402,7 +405,8 @@ func (m *APIServiceSpec) Size() (n int) {
l = len(m.CABundle) l = len(m.CABundle)
n += 1 + l + sovGenerated(uint64(l)) n += 1 + l + sovGenerated(uint64(l))
} }
n += 1 + sovGenerated(uint64(m.Priority)) n += 1 + sovGenerated(uint64(m.GroupPriorityMinimum))
n += 1 + sovGenerated(uint64(m.VersionPriority))
return n return n
} }
@ -488,7 +492,8 @@ func (this *APIServiceSpec) String() string {
`Version:` + fmt.Sprintf("%v", this.Version) + `,`, `Version:` + fmt.Sprintf("%v", this.Version) + `,`,
`InsecureSkipTLSVerify:` + fmt.Sprintf("%v", this.InsecureSkipTLSVerify) + `,`, `InsecureSkipTLSVerify:` + fmt.Sprintf("%v", this.InsecureSkipTLSVerify) + `,`,
`CABundle:` + valueToStringGenerated(this.CABundle) + `,`, `CABundle:` + valueToStringGenerated(this.CABundle) + `,`,
`Priority:` + fmt.Sprintf("%v", this.Priority) + `,`, `GroupPriorityMinimum:` + fmt.Sprintf("%v", this.GroupPriorityMinimum) + `,`,
`VersionPriority:` + fmt.Sprintf("%v", this.VersionPriority) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -1140,11 +1145,11 @@ func (m *APIServiceSpec) Unmarshal(dAtA []byte) error {
m.CABundle = []byte{} m.CABundle = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 6: case 7:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) return fmt.Errorf("proto: wrong wireType = %d for field GroupPriorityMinimum", wireType)
} }
m.Priority = 0 m.GroupPriorityMinimum = 0
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowGenerated return ErrIntOverflowGenerated
@ -1154,7 +1159,26 @@ func (m *APIServiceSpec) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.Priority |= (int64(b) & 0x7F) << shift m.GroupPriorityMinimum |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field VersionPriority", wireType)
}
m.VersionPriority = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.VersionPriority |= (int32(b) & 0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
@ -1479,56 +1503,58 @@ func init() {
} }
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 801 bytes of a gzipped FileDescriptorProto // 833 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x4f, 0xe3, 0x46,
0x14, 0xf6, 0x3a, 0xfe, 0x95, 0x49, 0x68, 0xc3, 0xa0, 0x0a, 0xcb, 0x12, 0xeb, 0x60, 0x24, 0x70, 0x14, 0x8e, 0x21, 0x21, 0x61, 0xa0, 0x0b, 0x9d, 0xee, 0x6a, 0x23, 0xd4, 0x1a, 0x9a, 0x4a, 0x2d,
0x11, 0xdd, 0x25, 0x05, 0xf1, 0x43, 0x9c, 0xba, 0x39, 0x54, 0x96, 0x5c, 0xa8, 0xc6, 0x51, 0x0f, 0x5b, 0x69, 0xed, 0xb2, 0xad, 0xfa, 0x43, 0x3d, 0x61, 0x0e, 0x08, 0x09, 0x5a, 0x34, 0x41, 0x1c,
0x08, 0x89, 0x8e, 0xd7, 0x2f, 0xeb, 0xc1, 0xd9, 0x1f, 0xcc, 0xcc, 0x5a, 0xf2, 0xad, 0x7f, 0x02, 0xaa, 0x4a, 0xdd, 0x89, 0xf3, 0x30, 0xd3, 0xe0, 0xb1, 0x3b, 0x33, 0x8e, 0x94, 0xdb, 0xfe, 0x09,
0x17, 0xfe, 0xa7, 0x1c, 0x38, 0xf4, 0x98, 0x93, 0x45, 0xcc, 0x7f, 0xd1, 0x0b, 0x68, 0x66, 0x67, 0xbd, 0xf4, 0x7f, 0xe2, 0xd0, 0xc3, 0x1e, 0x39, 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0xd6, 0x36, 0x08, 0x00,
0x00, 0x00,
} }

View File

@ -91,14 +91,19 @@ message APIServiceSpec {
// CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate.
optional bytes caBundle = 5; optional bytes caBundle = 5;
// Priority controls the ordering of this API group in the overall discovery document that gets served. // GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is prefered by clients over lower priority ones.
// Client tools like `kubectl` use this ordering to derive preference, so this ordering mechanism is important. // Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority.
// Values must be between 1 and 1000 // The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10).
// The primary sort is based on priority, ordered lowest number to highest (10 before 20).
// The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo)
// We'd recommend something like: *.k8s.io (except extensions) at 100, extensions at 150 // We'd recommend something like: *.k8s.io (except extensions) at 18000 and
// PaaSes (OpenShift, Deis) are recommended to be in the 200s // PaaSes (OpenShift, Deis) are recommended to be in the 2000s
optional int64 priority = 6; optional int32 groupPriorityMinimum = 7;
// 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.
optional int32 versionPriority = 8;
} }
// APIServiceStatus contains derived information about an API server // APIServiceStatus contains derived information about an API server

View File

@ -53,14 +53,22 @@ type APIServiceSpec struct {
// CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. // CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate.
CABundle []byte `json:"caBundle" protobuf:"bytes,5,opt,name=caBundle"` CABundle []byte `json:"caBundle" protobuf:"bytes,5,opt,name=caBundle"`
// Priority controls the ordering of this API group in the overall discovery document that gets served. // GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is prefered by clients over lower priority ones.
// Client tools like `kubectl` use this ordering to derive preference, so this ordering mechanism is important. // Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority.
// Values must be between 1 and 1000 // The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10).
// The primary sort is based on priority, ordered lowest number to highest (10 before 20).
// The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) // The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo)
// We'd recommend something like: *.k8s.io (except extensions) at 100, extensions at 150 // We'd recommend something like: *.k8s.io (except extensions) at 18000 and
// PaaSes (OpenShift, Deis) are recommended to be in the 200s // PaaSes (OpenShift, Deis) are recommended to be in the 2000s
Priority int64 `json:"priority" protobuf:"varint,6,opt,name=priority"` GroupPriorityMinimum int32 `json:"groupPriorityMinimum" protobuf:"varint,7,opt,name=groupPriorityMinimum"`
// 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.
VersionPriority int32 `json:"versionPriority" protobuf:"varint,8,opt,name=versionPriority"`
// leaving this here so everyone remembers why proto index 6 is skipped
// Priority int64 `json:"priority" protobuf:"varint,6,opt,name=priority"`
} }
type ConditionStatus string type ConditionStatus string

View File

@ -142,7 +142,8 @@ func autoConvert_v1beta1_APIServiceSpec_To_apiregistration_APIServiceSpec(in *AP
out.Version = in.Version out.Version = in.Version
out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify out.InsecureSkipTLSVerify = in.InsecureSkipTLSVerify
out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle))
out.Priority = in.Priority out.GroupPriorityMinimum = in.GroupPriorityMinimum
out.VersionPriority = in.VersionPriority
return nil return nil
} }
@ -161,7 +162,8 @@ func autoConvert_apiregistration_APIServiceSpec_To_v1beta1_APIServiceSpec(in *ap
} else { } else {
out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle))
} }
out.Priority = in.Priority out.GroupPriorityMinimum = in.GroupPriorityMinimum
out.VersionPriority = in.VersionPriority
return nil return nil
} }

View File

@ -58,9 +58,11 @@ func ValidateAPIService(apiService *apiregistration.APIService) field.ErrorList
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "version"), apiService.Spec.Version, errString)) allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "version"), apiService.Spec.Version, errString))
} }
if apiService.Spec.Priority <= 0 || apiService.Spec.Priority > 1000 { if apiService.Spec.GroupPriorityMinimum <= 0 || apiService.Spec.GroupPriorityMinimum > 10000 {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "priority"), apiService.Spec.Priority, "priority must be positive and less than 1000")) allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "groupPriorityMinimum"), apiService.Spec.GroupPriorityMinimum, "must be positive and less than 10000"))
}
if apiService.Spec.VersionPriority <= 0 || apiService.Spec.VersionPriority > 1000 {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "versionPriority"), apiService.Spec.VersionPriority, "must be positive and less than 1000"))
} }
if apiService.Spec.Service == nil { if apiService.Spec.Service == nil {

View File

@ -18,6 +18,7 @@ package apiserver
import ( import (
"errors" "errors"
"fmt"
"net/http" "net/http"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
@ -73,7 +74,7 @@ func (r *apisHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
apiServicesByGroup := apiregistrationapi.SortedByGroup(apiServices) apiServicesByGroup := apiregistrationapi.SortedByGroupAndVersion(apiServices)
for _, apiGroupServers := range apiServicesByGroup { for _, apiGroupServers := range apiServicesByGroup {
// skip the legacy group // skip the legacy group
if len(apiGroupServers[0].Spec.Group) == 0 { if len(apiGroupServers[0].Spec.Group) == 0 {
@ -91,11 +92,12 @@ func (r *apisHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// convertToDiscoveryAPIGroup takes apiservices in a single group and returns a discovery compatible object. // convertToDiscoveryAPIGroup takes apiservices in a single group and returns a discovery compatible object.
// if none of the services are available, it will return nil. // if none of the services are available, it will return nil.
func convertToDiscoveryAPIGroup(apiServices []*apiregistrationapi.APIService) *metav1.APIGroup { func convertToDiscoveryAPIGroup(apiServices []*apiregistrationapi.APIService) *metav1.APIGroup {
apiServicesByGroup := apiregistrationapi.SortedByGroup(apiServices)[0] apiServicesByGroup := apiregistrationapi.SortedByGroupAndVersion(apiServices)[0]
var discoveryGroup *metav1.APIGroup var discoveryGroup *metav1.APIGroup
for _, apiService := range apiServicesByGroup { for _, apiService := range apiServicesByGroup {
fmt.Printf("#### %#v\n", apiService)
if !apiregistrationapi.IsAPIServiceConditionTrue(apiService, apiregistrationapi.Available) { if !apiregistrationapi.IsAPIServiceConditionTrue(apiService, apiregistrationapi.Available) {
continue continue
} }

View File

@ -60,9 +60,9 @@ func TestAPIs(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "foo", Group: "foo",
Version: "v1", Version: "v1",
Priority: 10, GroupPriorityMinimum: 10,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -77,9 +77,9 @@ func TestAPIs(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "bar", Group: "bar",
Version: "v1", Version: "v1",
Priority: 11, GroupPriorityMinimum: 11,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -131,9 +131,10 @@ func TestAPIs(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "foo", Group: "foo",
Version: "v1", Version: "v1",
Priority: 20, GroupPriorityMinimum: 1,
VersionPriority: 15,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -148,9 +149,9 @@ func TestAPIs(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "bar", Group: "bar",
Version: "v2", Version: "v2",
Priority: 11, GroupPriorityMinimum: 11,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -165,9 +166,10 @@ func TestAPIs(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "foo", Group: "foo",
Version: "v2", Version: "v2",
Priority: 1, GroupPriorityMinimum: 20,
VersionPriority: 10,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -182,9 +184,9 @@ func TestAPIs(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "bar", Group: "bar",
Version: "v1", Version: "v1",
Priority: 11, GroupPriorityMinimum: 11,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -336,9 +338,10 @@ func TestAPIGroup(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "foo", Group: "foo",
Version: "v1", Version: "v1",
Priority: 20, GroupPriorityMinimum: 1,
VersionPriority: 15,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -353,9 +356,9 @@ func TestAPIGroup(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "bar", Group: "bar",
Version: "v2", Version: "v2",
Priority: 11, GroupPriorityMinimum: 11,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -370,9 +373,10 @@ func TestAPIGroup(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "foo", Group: "foo",
Version: "v2", Version: "v2",
Priority: 1, GroupPriorityMinimum: 20,
VersionPriority: 10,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{
@ -387,9 +391,9 @@ func TestAPIGroup(t *testing.T) {
Namespace: "ns", Namespace: "ns",
Name: "api", Name: "api",
}, },
Group: "bar", Group: "bar",
Version: "v1", Version: "v1",
Priority: 11, GroupPriorityMinimum: 11,
}, },
Status: apiregistration.APIServiceStatus{ Status: apiregistration.APIServiceStatus{
Conditions: []apiregistration.APIServiceCondition{ Conditions: []apiregistration.APIServiceCondition{