Commit 17eb5813 authored by Solly Ross's avatar Solly Ross

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.
parent 4a8d041c
...@@ -17,6 +17,7 @@ limitations under the License. ...@@ -17,6 +17,7 @@ limitations under the License.
package apiserver package apiserver
import ( import (
"fmt"
"net/http" "net/http"
"time" "time"
...@@ -26,6 +27,7 @@ import ( ...@@ -26,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request" genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/registry/rest"
...@@ -261,7 +263,7 @@ func (s *APIAggregator) AddAPIService(apiService *apiregistration.APIService) er ...@@ -261,7 +263,7 @@ func (s *APIAggregator) AddAPIService(apiService *apiregistration.APIService) er
} }
proxyHandler.updateAPIService(apiService) proxyHandler.updateAPIService(apiService)
if err := s.openAPIAggregator.loadApiServiceSpec(proxyHandler, apiService); err != nil { 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.proxyHandlers[apiService.Name] = proxyHandler
s.GenericAPIServer.Handler.NonGoRestfulMux.Handle(proxyPath, proxyHandler) s.GenericAPIServer.Handler.NonGoRestfulMux.Handle(proxyPath, proxyHandler)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment