mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-01 17:29:00 +00:00
Merge pull request #50166 from DirectXMan12/bug/fix-aggregator-with-no-openapi
Automatic merge from submit-queue (batch tested with PRs 49524, 46760, 50206, 50166, 49603) Handle missing OpenAPI specs on aggregated servers Previously, the aggregator would fail to actually set up the aggregator proxy for an API server that was missing an OpenAPI spec. It would show up in discovery, but the actual proxying would fail to occur. Now, we simply log an error if we can't fetch an OpenAPI spec for a particular aggregated server, and continue on. Fixes #50165 ```release-note NONE ```
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package apiserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
@@ -261,7 +263,7 @@ func (s *APIAggregator) AddAPIService(apiService *apiregistration.APIService) er
|
||||
}
|
||||
proxyHandler.updateAPIService(apiService)
|
||||
if err := s.openAPIAggregator.loadApiServiceSpec(proxyHandler, apiService); err != nil {
|
||||
return err
|
||||
utilruntime.HandleError(fmt.Errorf("unable to load OpenAPI spec for API service %s: %v", apiService.Name, err))
|
||||
}
|
||||
s.proxyHandlers[apiService.Name] = proxyHandler
|
||||
s.GenericAPIServer.Handler.NonGoRestfulMux.Handle(proxyPath, proxyHandler)
|
||||
|
Reference in New Issue
Block a user