fix apiserver InstallAPIGroups slices out of range
Signed-off-by: Icarus9913 <icaruswu66@qq.com> Kubernetes-commit: 07c945536089e38b1b824b371d199d75075da731
This commit is contained in:
parent
0d160f0770
commit
6099c06f68
|
|
@ -836,6 +836,9 @@ func (s *GenericAPIServer) InstallLegacyAPIGroup(apiPrefix string, apiGroupInfo
|
|||
// underlying storage will be destroyed on this servers shutdown.
|
||||
func (s *GenericAPIServer) InstallAPIGroups(apiGroupInfos ...*APIGroupInfo) error {
|
||||
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.
|
||||
// Catching these here places the error much closer to its origin
|
||||
if len(apiGroupInfo.PrioritizedVersions[0].Group) == 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue