You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2022/12/08 14:50:06 UTC
[beam] branch master updated: [Tour Of Beam] Playground Router GRPC API host (#24542)
This is an automated email from the ASF dual-hosted git repository.
damccorm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new a40e79b16f7 [Tour Of Beam] Playground Router GRPC API host (#24542)
a40e79b16f7 is described below
commit a40e79b16f7d6d79fad52e65d584f316cb55e863
Author: Evgeny Antyshev <ea...@gmail.com>
AuthorDate: Thu Dec 8 17:49:59 2022 +0300
[Tour Of Beam] Playground Router GRPC API host (#24542)
* aio
* fix
* README
* adjust
* -redis
* reset values
* -redis
---
learning/tour-of-beam/backend/README.md | 18 +++++++-
.../templates/deployment-router-grpc.yml | 48 ++++++++++++++++++++++
.../templates/service-router-grpc.yml | 31 ++++++++++++++
3 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/learning/tour-of-beam/backend/README.md b/learning/tour-of-beam/backend/README.md
index e6f31d88795..04c4e938a28 100644
--- a/learning/tour-of-beam/backend/README.md
+++ b/learning/tour-of-beam/backend/README.md
@@ -87,10 +87,24 @@ Prerequisites:
* Cloud Functions API
* Firebase Admin API
* Secret Manager API
+ - existing setup of Playground backend in a project
+ * (output) GKE_CLUSTER_NAME (`playground` by default)
+ * (output) GKE_ZONE, like `us-east1-b`
- set environment variables:
* PROJECT_ID: GCP id
* REGION: the region, "us-central1" fe
- - existing setup of Playground backend in a project
+ * PLAYGROUND_ROUTER_HOST: router serving Playground Router GRPC API
+
+__To discover Router host:__
+```
+# setup kubectl credentials
+gcloud container clusters get-credentials $GKE_CLUSTER_NAME --zone $GKE_ZONE --project $PROJECT_ID
+
+# get external host:port of a backend-router-grpc service
+PLAYGROUND_ROUTER_HOST=$(kubectl get svc -l "app=backend-router-grpc" \
+ -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}:{.items[0].spec.ports[0].port}'\
+)
+```
1. Deploy Datastore indexes (but don't delete existing Playground indexes!)
```
@@ -103,7 +117,7 @@ for endpoint in getSdkList getContentTree getUnitContent getUserProgress postUni
gcloud functions deploy $endpoint --entry-point $endpoint \
--region $REGION --runtime go116 --allow-unauthenticated \
--trigger-http \
- --set-env-vars="DATASTORE_PROJECT_ID=$PROJECT_ID,GOOGLE_PROJECT_ID=$PROJECT_ID"
+ --set-env-vars="DATASTORE_PROJECT_ID=$PROJECT_ID,GOOGLE_PROJECT_ID=$PROJECT_ID,PLAYGROUND_ROUTER_HOST=$PLAYGROUND_ROUTER_HOST"
done
```
diff --git a/playground/infrastructure/helm-playground/templates/deployment-router-grpc.yml b/playground/infrastructure/helm-playground/templates/deployment-router-grpc.yml
new file mode 100644
index 00000000000..abdd2b3bbce
--- /dev/null
+++ b/playground/infrastructure/helm-playground/templates/deployment-router-grpc.yml
@@ -0,0 +1,48 @@
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: playground-router-grpc
+ labels:
+ app: backend-router-grpc
+ type: backend
+spec:
+ template:
+ metadata:
+ name: playground
+ labels:
+ app: backend-router-grpc
+ type: backend
+ spec:
+ containers:
+ - name: playground-backend-router-grpc
+ image: "{{ .Values.registry}}/{{ .Values.image.router_image }}:{{ .Values.tag }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ env:
+ - name: GOOGLE_CLOUD_PROJECT
+ value: {{ .Values.project_id }}
+ - name: CACHE_TYPE
+ value: "remote"
+ - name: CACHE_ADDRESS
+ value: {{ .Values.redis_ip }}
+ - name: PROTOCOL_TYPE
+ value: TCP
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ app: backend-router-grpc
diff --git a/playground/infrastructure/helm-playground/templates/service-router-grpc.yml b/playground/infrastructure/helm-playground/templates/service-router-grpc.yml
new file mode 100644
index 00000000000..c2bac562ae8
--- /dev/null
+++ b/playground/infrastructure/helm-playground/templates/service-router-grpc.yml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: Service
+metadata:
+ labels:
+ app: backend-router-grpc
+ type: backend
+ name: playground-router-grpc-service
+spec:
+ type: LoadBalancer
+ selector:
+ app: backend-router-grpc
+ ports:
+ - name: grpc
+ port: 8080
+ protocol: TCP
+ targetPort: 8080