mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
fix apiserver InstallAPIGroups slices out of range
Signed-off-by: Icarus9913 <icaruswu66@qq.com>
This commit is contained in:
parent
06bde4f689
commit
07c9455360
@ -836,6 +836,9 @@ func (s *GenericAPIServer) InstallLegacyAPIGroup(apiPrefix string, apiGroupInfo
|
|||||||
// underlying storage will be destroyed on this servers shutdown.
|
// underlying storage will be destroyed on this servers shutdown.
|
||||||
func (s *GenericAPIServer) InstallAPIGroups(apiGroupInfos ...*APIGroupInfo) error {
|
func (s *GenericAPIServer) InstallAPIGroups(apiGroupInfos ...*APIGroupInfo) error {
|
||||||
for _, apiGroupInfo := range apiGroupInfos {
|
for _, apiGroupInfo := range apiGroupInfos {
|
||||||
|
if len(apiGroupInfo.PrioritizedVersions) == 0 {
|
||||||
|
return fmt.Errorf("no version priority set for %#v", *apiGroupInfo)
|
||||||
|
}
|
||||||
// Do not register empty group or empty version. Doing so claims /apis/ for the wrong entity to be returned.
|
// Do not register empty group or empty version. Doing so claims /apis/ for the wrong entity to be returned.
|
||||||
// Catching these here places the error much closer to its origin
|
// Catching these here places the error much closer to its origin
|
||||||
if len(apiGroupInfo.PrioritizedVersions[0].Group) == 0 {
|
if len(apiGroupInfo.PrioritizedVersions[0].Group) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user