mirror of
https://github.com/rancher/steve.git
synced 2025-09-01 23:47:50 +00:00
Implement /ext in Steve for Imperative API (#287)
This implements the Imperative API that is served at /ext with Steve. The imperative API is compatible with Kubernetes' API server and will be used as an extension API server.
This commit is contained in:
@@ -14,6 +14,9 @@ type Handlers struct {
|
||||
APIRoot http.Handler
|
||||
K8sProxy http.Handler
|
||||
Next http.Handler
|
||||
// ExtensionAPIServer serves under /ext. If nil, the default unknown path
|
||||
// handler is served.
|
||||
ExtensionAPIServer http.Handler
|
||||
}
|
||||
|
||||
func Routes(h Handlers) http.Handler {
|
||||
@@ -25,6 +28,11 @@ func Routes(h Handlers) http.Handler {
|
||||
m.Path("/").Handler(h.APIRoot).HeadersRegexp("Accept", ".*json.*")
|
||||
m.Path("/{name:v1}").Handler(h.APIRoot)
|
||||
|
||||
if h.ExtensionAPIServer != nil {
|
||||
m.Path("/ext").Handler(http.StripPrefix("/ext", h.ExtensionAPIServer))
|
||||
m.PathPrefix("/ext/").Handler(http.StripPrefix("/ext", h.ExtensionAPIServer))
|
||||
}
|
||||
|
||||
m.Path("/v1/{type}").Handler(h.K8sResource)
|
||||
m.Path("/v1/{type}/{nameorns}").Queries("link", "{link}").Handler(h.K8sResource)
|
||||
m.Path("/v1/{type}/{nameorns}").Queries("action", "{action}").Handler(h.K8sResource)
|
||||
|
Reference in New Issue
Block a user