Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genericapiserver: Moving InstallSwaggerAPI to Run #23554

Merged
merged 1 commit into from
Apr 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions pkg/genericapiserver/genericapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,13 @@ func (s *GenericAPIServer) init(c *Config) {
s.installGroupsDiscoveryHandler()
}

// Exposes the given group versions in API.
// 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 {
if err := s.InstallAPIGroup(&apiGroupInfo); err != nil {
return err
}
}
if s.enableSwaggerSupport {
s.InstallSwaggerAPI()
}
return nil
}

Expand All @@ -652,7 +649,10 @@ func (s *GenericAPIServer) installGroupsDiscoveryHandler() {
}

func (s *GenericAPIServer) Run(options *ServerRunOptions) {
// We serve on 2 ports. See docs/accessing_the_api.md
if s.enableSwaggerSupport {
s.InstallSwaggerAPI()
}
// We serve on 2 ports. See docs/accessing_the_api.md
secureLocation := ""
if options.SecurePort != 0 {
secureLocation = net.JoinHostPort(options.BindAddress.String(), strconv.Itoa(options.SecurePort))
Expand Down Expand Up @@ -768,7 +768,8 @@ func shouldGenSelfSignedCerts(certPath, keyPath string) bool {
return true
}

func (s *GenericAPIServer) installAPIGroup(apiGroupInfo *APIGroupInfo) error {
// Exposes the given group version in API.
func (s *GenericAPIServer) InstallAPIGroup(apiGroupInfo *APIGroupInfo) error {
apiPrefix := s.APIGroupPrefix
if apiGroupInfo.IsLegacyGroup {
apiPrefix = s.APIPrefix
Expand Down
2 changes: 2 additions & 0 deletions test/integration/kubectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func TestKubectlValidation(t *testing.T) {
defer components.Stop(true, true)
ctx := clientcmdapi.NewContext()
cfg := clientcmdapi.NewConfig()
// Enable swagger api on master.
components.KubeMaster.InstallSwaggerAPI()
cluster := clientcmdapi.NewCluster()
cluster.Server = components.ApiServer.URL
cluster.InsecureSkipTLSVerify = true
Expand Down