Merge pull request #118093 from Icarus9913/fix/wk/apiserver
fix apiserver InstallAPIGroups slices out of range
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user