diff --git a/apiserver/DEVELOPMENT.md b/apiserver/DEVELOPMENT.md index e8988a7edb..b6f0bee9c2 100644 --- a/apiserver/DEVELOPMENT.md +++ b/apiserver/DEVELOPMENT.md @@ -97,36 +97,7 @@ To update the swagger ui files deployed with the Kuberay API server, you'll need * Manually run the [hack/update-swagger-ui.bash](hack/update-swagger-ui.bash) script. The script downloads the swagger ui release and copies the downloaded files to the [../third_party/swagger-ui](../third_party/swagger-ui/) directory. It copies the [swagger-initializer.js](../third_party/swagger-ui/swagger-initializer.js) to [swagger-initializer.js.backup](../third_party/swagger-ui/swagger-initializer.js.backup). -* Update the contents of the [swagger-initializer.js](../third_party/swagger-ui/swagger-initializer.js) to set the URLs for for the individual swagger docs. The content of the file is show below: - - ```javascript - window.onload = function() { - // - - // the following lines will be replaced by docker/configurator, when it runs in a docker-container - window.ui = SwaggerUIBundle({ - spec: location.host, - urls: [{"url":"http://"+location.host+"/swagger/serve.swagger.json","name":"RayServe Service"}, - {"url":"http://"+location.host+"/swagger/error.swagger.json","name":"Errors API"}, - {"url":"http://"+location.host+"/swagger/job.swagger.json","name":"RayJob Service"}, - {"url":"http://"+location.host+"/swagger/config.swagger.json","name":"ComputeTemplate Service"}, - {"url":"http://"+location.host+"/swagger/cluster.swagger.json","name":"Cluster Service"}], - dom_id: '#swagger-ui', - deepLinking: true, - presets: [ - SwaggerUIBundle.presets.apis, - SwaggerUIStandalonePreset - ], - plugins: [ - SwaggerUIBundle.plugins.DownloadUrl - ], - layout: "StandaloneLayout" - }); - - // - }; - ``` - +* Update the contents of the [swagger-initializer.js](../third_party/swagger-ui/swagger-initializer.js) to set the URLs for for the individual swagger docs. * Execute `make build-swagger` target to update the contents of the [datafile.go](pkg/swagger/datafile.go) file. This will package the content of the [swagger-ui](../third_party/swagger-ui/) directory for serving by the api server (see [func serveSwaggerUI(mux *http.ServeMux)](https://github.com/ray-project/kuberay/blob/f1067378bc99987f3eba1e5b12b4cc797465336d/apiserver/cmd/main.go#L149) in [main.go](cmd/main.go)) The swagger ui is available at the following URLs: diff --git a/third_party/swagger-ui/swagger-initializer.js b/third_party/swagger-ui/swagger-initializer.js index 3eaadc5698..4bb7c6e895 100644 --- a/third_party/swagger-ui/swagger-initializer.js +++ b/third_party/swagger-ui/swagger-initializer.js @@ -4,11 +4,11 @@ window.onload = function() { // the following lines will be replaced by docker/configurator, when it runs in a docker-container window.ui = SwaggerUIBundle({ spec: location.host, - urls: [{"url":"http://"+location.host+"/swagger/serve.swagger.json","name":"RayServe Service"}, - {"url":"http://"+location.host+"/swagger/error.swagger.json","name":"Errors API"}, - {"url":"http://"+location.host+"/swagger/job.swagger.json","name":"RayJob Service"}, - {"url":"http://"+location.host+"/swagger/config.swagger.json","name":"ComputeTemplate Service"}, - {"url":"http://"+location.host+"/swagger/cluster.swagger.json","name":"Cluster Service"}], + urls: [{"url":window.location.protocol+"//"+location.host+"/swagger/serve.swagger.json","name":"RayServe Service"}, + {"url":window.location.protocol+"//"+location.host+"/swagger/error.swagger.json","name":"Errors API"}, + {"url":window.location.protocol+"//"+location.host+"/swagger/job.swagger.json","name":"RayJob Service"}, + {"url":window.location.protocol+"//"+location.host+"/swagger/config.swagger.json","name":"ComputeTemplate Service"}, + {"url":window.location.protocol+"//"+location.host+"/swagger/cluster.swagger.json","name":"Cluster Service"}], dom_id: '#swagger-ui', deepLinking: true, presets: [