mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #33266 from sttts/sttts-one-installapigroups
Automatic merge from submit-queue Reduce genericapiserver api surface
This commit is contained in:
		@@ -98,7 +98,7 @@ func Run(serverOptions *genericoptions.ServerRunOptions) error {
 | 
				
			|||||||
		Scheme:               api.Scheme,
 | 
							Scheme:               api.Scheme,
 | 
				
			||||||
		NegotiatedSerializer: api.Codecs,
 | 
							NegotiatedSerializer: api.Codecs,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := s.InstallAPIGroups([]genericapiserver.APIGroupInfo{apiGroupInfo}); err != nil {
 | 
						if err := s.InstallAPIGroup(&apiGroupInfo); err != nil {
 | 
				
			||||||
		return fmt.Errorf("Error in installing API: %v", err)
 | 
							return fmt.Errorf("Error in installing API: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	s.Run(serverOptions)
 | 
						s.Run(serverOptions)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -216,16 +216,6 @@ func NewHandlerContainer(mux *http.ServeMux, s runtime.NegotiatedSerializer) *re
 | 
				
			|||||||
	return container
 | 
						return container
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Exposes the given group versions in API. Helper method to install multiple group versions at once.
 | 
					 | 
				
			||||||
func (s *GenericAPIServer) InstallAPIGroups(groupsInfo []APIGroupInfo) error {
 | 
					 | 
				
			||||||
	for _, apiGroupInfo := range groupsInfo {
 | 
					 | 
				
			||||||
		if err := s.InstallAPIGroup(&apiGroupInfo); err != nil {
 | 
					 | 
				
			||||||
			return err
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return nil
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Installs handler at /apis to list all group versions for discovery
 | 
					// Installs handler at /apis to list all group versions for discovery
 | 
				
			||||||
func (s *GenericAPIServer) installGroupsDiscoveryHandler() {
 | 
					func (s *GenericAPIServer) installGroupsDiscoveryHandler() {
 | 
				
			||||||
	apiserver.AddApisWebService(s.Serializer, s.HandlerContainer, s.apiPrefix, func(req *restful.Request) []unversioned.APIGroup {
 | 
						apiserver.AddApisWebService(s.Serializer, s.HandlerContainer, s.apiPrefix, func(req *restful.Request) []unversioned.APIGroup {
 | 
				
			||||||
@@ -384,7 +374,7 @@ func (s *GenericAPIServer) Run(options *options.ServerRunOptions) {
 | 
				
			|||||||
	select {}
 | 
						select {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Exposes the given group version in API.
 | 
					// Exposes the given api group in the API.
 | 
				
			||||||
func (s *GenericAPIServer) InstallAPIGroup(apiGroupInfo *APIGroupInfo) error {
 | 
					func (s *GenericAPIServer) InstallAPIGroup(apiGroupInfo *APIGroupInfo) error {
 | 
				
			||||||
	apiPrefix := s.apiPrefix
 | 
						apiPrefix := s.apiPrefix
 | 
				
			||||||
	if apiGroupInfo.IsLegacyGroup {
 | 
						if apiGroupInfo.IsLegacyGroup {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -138,7 +138,9 @@ func TestInstallAPIGroups(t *testing.T) {
 | 
				
			|||||||
			NegotiatedSerializer:         api.Codecs,
 | 
								NegotiatedSerializer:         api.Codecs,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	s.InstallAPIGroups(apiGroupsInfo)
 | 
						for i := range apiGroupsInfo {
 | 
				
			||||||
 | 
							s.InstallAPIGroup(&apiGroupsInfo[i])
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	server := httptest.NewServer(s.HandlerContainer.ServeMux)
 | 
						server := httptest.NewServer(s.HandlerContainer.ServeMux)
 | 
				
			||||||
	defer server.Close()
 | 
						defer server.Close()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -348,9 +348,11 @@ func (m *Master) InstallAPIs(c *Config) {
 | 
				
			|||||||
		apiGroupsInfo = append(apiGroupsInfo, apiGroupInfo)
 | 
							apiGroupsInfo = append(apiGroupsInfo, apiGroupInfo)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := m.InstallAPIGroups(apiGroupsInfo); err != nil {
 | 
						for i := range apiGroupsInfo {
 | 
				
			||||||
 | 
							if err := m.InstallAPIGroup(&apiGroupsInfo[i]); err != nil {
 | 
				
			||||||
			glog.Fatalf("Error in registering group versions: %v", err)
 | 
								glog.Fatalf("Error in registering group versions: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (m *Master) initV1ResourcesStorage(c *Config) {
 | 
					func (m *Master) initV1ResourcesStorage(c *Config) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user