I have several microservices (about 14 ) running on GKE. There is Graphql just in front these microservices. This is the design of the developers. I am a DevOps engineer and part of my job is to deploy those microservices for frontend engineers to consume the APIs. I followed
to quickly get onboard with with Cloud Endpoints. Never worked with it before. Neither have I worked with GraphQL before as well.
# [START swagger]
swagger: "2.0"
info:
description: "API Gateway Deployment."
title: "Roava API Gateway"
version: "1.0.0"
x-google-endpoints:
# [END swagger]
consumes:
- "application/json"
produces:
- "application/json"
schemes:
# Uncomment the next line if you configure SSL for this API.
- "https"
paths:
"/graphql":
get:
description: "Echo back a given message."
operationId: "ms-api"
produces:
- "application/json"
responses:
200:
description: "ms-api"
schema:
$ref: "#/definitions/echoMessage"
parameters:
- description: "Message to echo"
in: body
name: message
required: true
schema:
$ref: "#/definitions/echoMessage"
security:
- api_key: []
"/auth/info/googlejwt":
get:
description: "Returns the requests' authentication information."
operationId: "auth_info_google_jwt"
produces:
- "application/json"
responses:
200:
description: "Authentication info."
schema:
$ref: "#/definitions/authInfoResponse"
security:
- google_jwt: []
"/auth/info/googleidtoken":
get:
description: "Returns the requests' authentication information."
operationId: "authInfoGoogleIdToken"
produces:
- "application/json"
responses:
200:
description: "Authentication info."
schema:
$ref: "#/definitions/authInfoResponse"
security:
- google_id_token: []
"/auth/info/firebase":
get:
description: "Returns the requests' authentication information."
operationId: "authInfoFirebase"
produces:
- "application/json"
responses:
200:
description: "Authentication info."
schema:
$ref: "#/definitions/authInfoResponse"
security:
- firebase: []
"/auth/info/auth0":
get:
description: "Returns the requests' authentication information."
operationId: "auth_info_auth0_jwk"
produces:
- "application/json"
responses:
200:
description: "Authentication info."
schema:
$ref: "#/definitions/authInfoResponse"
security:
- auth0_jwk: []
definitions:
echoMessage:
type: "object"
properties:
message:
type: "string"
authInfoResponse:
properties:
id:
type: "string"
email:
type: "string"
# This section requires all requests to any path to require an API key.
securityDefinitions:
# This section configures basic authentication with an API key.
api_key:
type: "apiKey"
name: "AIza"
in: "query"
# This section configures authentication using Google API Service Accounts
# to sign a json web token. This is mostly used for server-to-server
# communication.
google_jwt:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
# This must match the 'iss' field in the JWT.
# Update this with your service account's email address.
# This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients.
# This section configures authentication using Google OAuth2 ID Tokens.
# ID Tokens can be obtained using OAuth2 clients, and can be used to access
# your API on behalf of a particular user.
google_id_token:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
x-google-audiences: "YOUR-CLIENT-ID"
# This section configures authentication using Firebase Auth.
firebase:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
x-google-audiences: "YOUR-PROJECT-ID"
auth0_jwk:
# Update YOUR-ACCOUNT-NAME with your Auth0 account name.
flow: "implicit"
type: "oauth2"
# Update this with your service account's email address.
# Replace with your client ID, found in the Auth0 console.
x-google-audiences: "YOUR-CLIENT-ID"
Here is a snippet of k8s manifest containing google endpoints runtime docker image