Developer Portal
API Documentation
The DevPortal feature allows you to publish documentation for your APIs. For each API, the developer portal fetches the specified OpenAPI spec to render the documentation
Publishing the Documentation
The DevPortal configuration is served on path /portal
. By default, this path is not accessible publicly.
DevPortal configuration can be specified using GlobalConfig
. Only one GlobalConfig
of type DevPortal is required to specify the DevPortal configuration
---
apiVersion: enroute.saaras.io/v1
kind: GlobalConfig
metadata:
name: devportal-config
namespace: default
spec:
name: devportal-config
type: globalconfig_devportal
config: |
{
"service_docs" : [
{"service" : "default.httpbin", "doc_url" : "https://httpbin.org/spec.json" },
{"service" : "default.petstore","doc_url" : "https://petstore.swagger.io/v2/swagger.json" }
]
}
Public Access of DevPortal
A ServiceRoute
can be created to make the DevPortal configuration accessible publicly
First, define a service to access the DevPortal
apiVersion: v1
kind: Service
metadata:
labels:
app: enroute-apidocs
service: enroute-apidocs
name: enroute-apidocs
namespace: enroutedemo
spec:
ports:
- name: portal-port
port: 6060
protocol: TCP
targetPort: 6060
selector:
app: enroute
sessionAffinity: None
type: ClusterIP
Next, define a ServiceRoute
to make the service externally accessible
apiVersion: enroute.saaras.io/v1
kind: ServiceRoute
metadata:
labels:
app: enroute-apidocs
name: enroute-apidocs-6060-serviceroute-apidoc-route
namespace: enroutedemo
spec:
fqdn: '*'
route:
conditions:
- prefix: /portal
services:
- name: enroute-apidocs
port: 6060
Notes
DevPortal is included in the Enterprise Edition