Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining multiple backend services into one cloud endpoint API

Is it possible to combine multiple apps running in GKE into the same Google Cloud Endpoints service? For example, say I have a Flask app and also a Nodejs app serving both serving different api resources, can I combine these two backend services into the same cloud endpoints API. Thanks!

like image 263
David Brown Avatar asked Dec 18 '18 18:12

David Brown


1 Answers

Looks like there is a way!

You can add x-google-backend: to any of the end points, as long as you are deploying it as an actual gateway, not a Kubernetes side card.

Example:

# Specify a backend to handle all routes, paths will be appended to the base path
x-google-backend:
  address: https://backend-hash-uc.a.run.app
paths:
  /hello:
    get:
      summary: Greet a user
      operationId: hello
  /goodbye:
    get:
      summary: Bid a user goodbye
      operationId: goodbye
      # Per operation overrides
      # Path is overwritten and path parameters are specified as query params
      x-google-backend:
        address: https://backend2-hash-uc.a.run.app/goodbye

Source: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/google-cloud-endpoints/DehPzXAOzxI/Q3ABVK6zCQAJ

like image 125
Erik L Avatar answered Sep 30 '22 08:09

Erik L