mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 05:21:58 +00:00
kube-aggregator: update existing openapi spec info if pre-existing
This commit is contained in:
parent
1cca3f9d45
commit
1f1a524f48
@ -202,15 +202,16 @@ func (s *specAggregator) tryUpdatingServiceSpecs(specInfo *openAPISpecInfo) erro
|
||||
if specInfo == nil {
|
||||
return fmt.Errorf("invalid input: specInfo must be non-nil")
|
||||
}
|
||||
orgSpecInfo, exists := s.openAPISpecs[specInfo.apiService.Name]
|
||||
origSpecInfo, existedBefore := s.openAPISpecs[specInfo.apiService.Name]
|
||||
s.openAPISpecs[specInfo.apiService.Name] = specInfo
|
||||
|
||||
// Skip aggregation if OpenAPI spec didn't change
|
||||
if exists && orgSpecInfo != nil && orgSpecInfo.etag == specInfo.etag {
|
||||
if existedBefore && origSpecInfo != nil && origSpecInfo.etag == specInfo.etag {
|
||||
return nil
|
||||
}
|
||||
s.openAPISpecs[specInfo.apiService.Name] = specInfo
|
||||
if err := s.updateOpenAPISpec(); err != nil {
|
||||
if exists {
|
||||
s.openAPISpecs[specInfo.apiService.Name] = orgSpecInfo
|
||||
if existedBefore {
|
||||
s.openAPISpecs[specInfo.apiService.Name] = origSpecInfo
|
||||
} else {
|
||||
delete(s.openAPISpecs, specInfo.apiService.Name)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user