API
Tetrate Service Express (TSE) utilizes many of the same components as the Tetrate Service Bridge(TSB) product but has the several distinctions. Go to Comparing TSE and TSB for more details.
API objects define a set of servers and endpoints that expose the business logic for an Application. APIs are attached to existing Applications to configure how the features exposed by the different services that are part of the Application can be accessed.
The format used to define APIs is based on the OpenAPI v3 spec. Users can attach OpenAPI documents to the applications, and Service Express will generate all the configuration that is needed to make the APIs available. Service Express also provides a set of custom extensions to the OpenAPI spec that can be used to further customize the APIs in those cases where the standard OpenAPI properties are not sufficient.
The following example shows how an API can be attached to an existing application:
apiversion: application.tsb.tetrate.io/v2
kind: API
metadata:
organization: tse
tenant: tse
application: example-app
name: ezample-app-api
spec:
description: An example OpenAPI based API
workloadSelector:
namespace: exampleapp
labels:
app: exampleapp-gateway
openapi: |
openapi: 3.0.0
info:
title: Sample API
description: An example API defined in an OpenAPI spec
version: 0.1.9
x-tsb-service: sample-app.sample-ns # service exposing this api
servers:
- url: http://api.example.com/v1
description: Optional server description, e.g. Main (production) server
- url: http://staging-api.example.com
paths:
/users:
get:
summary: Returns a list of users.
description: Optional extended description in CommonMark or HTML.
responses:
'200': # status code
description: A JSON array of user names
content:
application/json:
schema:
type: array
items:
type: string
API
An API configuring a set of servers and endpoints that expose the Application business logic.
Field | Description | Validation Rule |
---|---|---|
openapi | string | string = { |
workloadSelector | tetrateio.api.tsb.types.v2.WorkloadSelector
| – |
servers | List of tetrateio.api.tsb.gateway.v2.HttpServer List of ingress gateways servers that expose the API. Server hostnames must be unique in the system, and only one API can expose a specific hostname. | – |
endpoints | List of tetrateio.api.tsb.application.v2.HTTPEndpoint | – |
httpServers | List of tetrateio.api.tsb.gateway.v2.HTTP | – |
ExposedBy
The exposer of an HTTPEndpoint.
Field | Description | Validation Rule |
---|---|---|
service | string oneof _exposer | – |
clusterGroup | tetrateio.api.tsb.application.v2.ExposedByClusters oneof _exposer | – |
ExposedByCluster
ExposedByCluster is a cluster or set of clusters identified by the labels that are exposing an endpoint.
Field | Description | Validation Rule |
---|---|---|
name | string | – |
labels | map<string, string> | – |
weight | uint32 | – |
ExposedByClusters
ExposedByClusters represents the clusters that are exposing a concrete endpoint.
Field | Description | Validation Rule |
---|---|---|
clusters | List of tetrateio.api.tsb.application.v2.ExposedByCluster | – |
HTTPEndpoint
An HTTP Endpoint represents an individual HTTP path exposed in the API.
Field | Description | Validation Rule |
---|---|---|
path | string | – |
methods | List of string | – |
hostnames | List of string | – |
service | string | – |
exposedBy | tetrateio.api.tsb.application.v2.ExposedBy | – |
ConfigResource
ConfigResource represents a configuration object (group, ingress gateway, etc) that is related to an Application or API.
Field | Description | Validation Rule |
---|---|---|
fqn | string | – |
expectedEtag | string When this field is present, the status will also reflect changes in the contents of the configuration resource, and report it as DIRTY if there are differences. | – |
exclusivelyOwned | bool | – |
ResourceStatus
The ResourceStatus object provides information about the status of the configuration related to an Application or an API object.
Applications and APIs are translated into configuration objects (config groups, ingress gateways, etc). This status object reflects the status of the Application and APIs with regard to the generated configuration, and exposes any configuration mismatch. This status only reflects the status of the configuration objects in Service Express . It does not provide information about the status of the generated configuration in the final clusters.
Field | Description | Validation Rule |
---|---|---|
status | tetrateio.api.tsb.application.v2.Status | – |
resources | List of tetrateio.api.tsb.application.v2.ResourceStatus.ConfigResourceStatus | – |
ConfigResourceStatus
Individual status for a configuration resource related to the Application/API.
Field | Description | Validation Rule |
---|---|---|
status | tetrateio.api.tsb.application.v2.Status | – |
resource | tetrateio.api.tsb.application.v2.ConfigResource | – |
Status
The computed configuration status for the Application or API.
Field | Number | Description |
---|---|---|
UNKNOWN | 0 | Unknown indicates that the status has not been computed. |
MISSING | 1 | The missing status indicates that the configuration resource for the Applications or APIs do not exist. |
DIRTY | 2 | Dirty Applications and APIs are those that have the corresponding configuration objects (config groups, ingress gateways, etc), but those objects have been directly modified or they current configuration does not match the one specified in the corresponding Application/API. |
CONFIGURED | 3 | Configured Applications and APIs are those that have the corresponding configuration resources (config groups, ingress gateways, etc) and their configurations match the ones defined in the Application/API objects. |