0

I have been reviewing Google Cloud Extensible Service Proxy, which promises to be a serverless NGINX instance, however I am unsure on how to proxy to multiple services running in app engine through it, and essentially use it as a gateway. It seems to demand a host in the swagger JSON configuration and an environment variable that points to the endpoint service name, and I don't see how it could proxy to multiple services given this constraint.

user293895
  • 1,465
  • 3
  • 22
  • 39

1 Answers1

1

My understanding is that you could host the Endpoints ESP using Cloud Run. This would then give you a single URL from which to access it but would spin up enough instances of the ESP if needed. The Open API specification document you would then register with it would contain paths corresponding to each instance of a service you want to expose. For each path, you would then define an x-google-backend pointing to the service URL that each path would resolve against.

EDIT: the yaml file will look somehow like this:

info:
  title: Cloud Endpoints with API Keys
  description: Sample API on Cloud Endpoints with multiple App Engine with IAP backend
  version: 1.0.0
host: <ENDPOINT_URL>
schemes:
  - https
produces:
  - application/json
paths:
  /hello-gae1:
    get:
      summary: Greet a user from App Engine
      operationId: hello_gae
      x-google-backend:
        address: https://<PROJECT_ID>.appspot.com
      parameters:
        - in: query
          name: name
          required: false
          type: string
      responses:
        '200':
          description: A successful response
          schema:
            type: string
  /hello-gae2:
    get:
      summary: Greet a user from App Engine
      operationId: hello_gae
      x-google-backend:
        address: https://<SERVICE-dot-PROJECT_ID>.appspot.com
      parameters:
        - in: query
          name: name
          required: false
          type: string
      responses:
        '200':
          description: A successful response
          schema:
            type: string
  /hello-gae3:
    get:
      summary: Greet a user from App Engine
      operationId: hello_gae
      x-google-backend:
        address: https://<SERVICE-dot-PROJECT_ID>.appspot.com
      parameters:
        - in: query
          name: name
          required: false
          type: string
      responses:
        '200':
          description: A successful response
          schema:
            type: string
securityDefinitions:
  # This section configures basic authentication with an API key.
  api_key:
    type: "apiKey"
    name: "key"
    in: "query"

References:

Soni Sol
  • 2,367
  • 3
  • 12
  • 23
Kolban
  • 13,794
  • 3
  • 38
  • 60