Autoset OpenAPI version w/o SecurityDefinitions

There's code to automatically populate OpenAPI info based on existing
generic apiserver config, but it only fires if securitydefinitions are
present.  This doesn't make much sense, since this info is both required
and independent of security definitions, and there's no easy, generic
way to generate security definitions for an aggregated API server.
This commit is contained in:
Solly Ross 2018-07-19 17:32:40 -04:00
parent d08e68e759
commit ef73bb684b

View File

@ -366,7 +366,8 @@ func (c *Config) Complete(informers informers.SharedInformerFactory) CompletedCo
c.ExternalAddress = net.JoinHostPort(c.ExternalAddress, strconv.Itoa(port))
}
if c.OpenAPIConfig != nil && c.OpenAPIConfig.SecurityDefinitions != nil {
if c.OpenAPIConfig != nil {
if c.OpenAPIConfig.SecurityDefinitions != nil {
// Setup OpenAPI security: all APIs will have the same authentication for now.
c.OpenAPIConfig.DefaultSecurity = []map[string][]string{}
keys := []string{}
@ -387,7 +388,9 @@ func (c *Config) Complete(informers informers.SharedInformerFactory) CompletedCo
},
}
}
}
// make sure we populate info, and info.version, if not manually set
if c.OpenAPIConfig.Info == nil {
c.OpenAPIConfig.Info = &spec.Info{}
}