mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 00:34:10 -04:00
Fix OpenAPI loading error caused by empty APIService
SpecAggregator's GetAPIServiceNames method returned empty APIService name by mistake, causing OpenAPI controller handling an invalid APIService continuously. Signed-off-by: Quan Tian <qtian@vmware.com>
This commit is contained in:
parent
dcce2357ff
commit
fb70875f1a
2 changed files with 4 additions and 4 deletions
|
|
@ -61,11 +61,11 @@ func IsLocalAPIService(apiServiceName string) bool {
|
|||
return strings.HasPrefix(apiServiceName, localDelegateChainNamePrefix)
|
||||
}
|
||||
|
||||
// GetAPIServicesName returns the names of APIServices recorded in specAggregator.openAPISpecs.
|
||||
// GetAPIServiceNames returns the names of APIServices recorded in specAggregator.openAPISpecs.
|
||||
// We use this function to pass the names of local APIServices to the controller in this package,
|
||||
// so that the controller can periodically sync the OpenAPI spec from delegation API servers.
|
||||
func (s *specAggregator) GetAPIServiceNames() []string {
|
||||
names := make([]string, len(s.openAPISpecs))
|
||||
names := make([]string, 0, len(s.openAPISpecs))
|
||||
for key := range s.openAPISpecs {
|
||||
names = append(names, key)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,14 +53,14 @@ func IsLocalAPIService(apiServiceName string) bool {
|
|||
return strings.HasPrefix(apiServiceName, localDelegateChainNamePrefix)
|
||||
}
|
||||
|
||||
// GetAPIServicesName returns the names of APIServices recorded in openAPIV3Specs.
|
||||
// GetAPIServiceNames returns the names of APIServices recorded in openAPIV3Specs.
|
||||
// We use this function to pass the names of local APIServices to the controller in this package,
|
||||
// so that the controller can periodically sync the OpenAPI spec from delegation API servers.
|
||||
func (s *specAggregator) GetAPIServiceNames() []string {
|
||||
s.rwMutex.Lock()
|
||||
defer s.rwMutex.Unlock()
|
||||
|
||||
names := make([]string, len(s.openAPIV3Specs))
|
||||
names := make([]string, 0, len(s.openAPIV3Specs))
|
||||
for key := range s.openAPIV3Specs {
|
||||
names = append(names, key)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue