Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: add region tags to yaml and sh #684

Merged
merged 23 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/snippet-bot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2022 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -10,4 +11,4 @@
# 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.
# limitations under the License.
3 changes: 1 addition & 2 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ jobs:
run: |
NAMESPACE="pr${PR_NUMBER}"
echo "::set-env name=NAMESPACE::$NAMESPACE"

gcloud container clusters get-credentials $PR_CLUSTER --zone $ZONE --project $PROJECT_ID
cat <<EOF | kubectl apply -f -
apiVersion: v1
Expand Down Expand Up @@ -141,4 +140,4 @@ jobs:
-H "Content-Type: application/json" \
-H "Authorization: token $GITHUB_TOKEN" \
--data '{ "body": "🚲 PR staged at '"http://${EXTERNAL_IP}"'"}'
sleep 60
sleep 60
4 changes: 3 additions & 1 deletion .github/workflows/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Copyright 2020 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


set -euo pipefail

# install wget
Expand Down
4 changes: 4 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_cloudbuild_microservice_demo_cloudbuild]

# This configuration file is used to build and deploy the app into a
# GKE cluster using Google Cloud Build.
#
Expand All @@ -37,3 +39,5 @@ steps:
timeout: '3600s'
options:
machineType: 'N1_HIGHCPU_8'

# [END gke_cloudbuild_microservice_demo_cloudbuild]
3 changes: 2 additions & 1 deletion hack/make-docker-images.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2019 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# Builds and pushes docker image for each demo microservice.

set -euo pipefail
Expand Down
15 changes: 11 additions & 4 deletions hack/make-release-artifacts.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2019 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# This script compiles manifest files with the image tags and places them in
# /release/...

Expand Down Expand Up @@ -49,13 +50,13 @@ EOF
read_manifests() {
local dir
dir="$1"

while IFS= read -d $'\0' -r file; do
# strip license headers (pattern "^# ")
awk '
/^[^# ]/ { found = 1 }
found { print }' "${file}"

echo "---"
done < <(find "${dir}" -name '*.yaml' -type f -print0)
}
Expand All @@ -76,13 +77,19 @@ mk_kubernetes_manifests() {

print_license_header
print_autogenerated_warning

echo '# [START gke_release_kubernetes_manifests_microservices_demo]'

echo "${out_manifest}"
echo "# [END gke_release_kubernetes_manifests_microservices_demo]"
}

mk_istio_manifests() {
print_license_header
print_autogenerated_warning
echo '# [START servicemesh_release_istio_manifests_microservices_demo]'
read_manifests "${SCRIPTDIR}/../istio-manifests"
echo '# [END servicemesh_release_istio_manifests_microservices_demo]'
}

main() {
Expand All @@ -97,5 +104,5 @@ main() {
mk_istio_manifests > "${istio_manifests_file}"
log "Written ${istio_manifests_file}"
}

# "$@"
main
3 changes: 2 additions & 1 deletion hack/make-release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2019 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# This script creates a new release by:
# - 1. building/pushing images
# - 2. injecting tags into YAML manifests
Expand Down
3 changes: 2 additions & 1 deletion istio-manifests/allow-egress-googleapis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion istio-manifests/frontend-gateway.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion istio-manifests/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ spec:
- destination:
host: frontend
port:
number: 80
number: 80
1 change: 1 addition & 0 deletions kubernetes-manifests/loadgenerator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# 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:
Expand Down
3 changes: 2 additions & 1 deletion kubernetes-manifests/redis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -104,4 +105,4 @@ build:
deploy:
kubectl:
manifests:
- ./kubernetes-manifests/loadgenerator.yaml
- ./kubernetes-manifests/loadgenerator.yaml
10 changes: 7 additions & 3 deletions src/adservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_adservice_genproto]
#!/bin/bash -eu

# protos are needed in adservice folder for compiling during Docker build.

mkdir -p proto && \
cp ../../pb/demo.proto src/main/proto

# [END gke_adservice_genproto]
8 changes: 6 additions & 2 deletions src/checkoutservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_checkoutservice_genproto]

PATH=$PATH:$GOPATH/bin
protodir=../../pb

protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto

# [END gke_checkoutservice_genproto]
8 changes: 6 additions & 2 deletions src/currencyservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_currencyservice_genproto]

# protos are loaded dynamically for node, simply copies over the proto.
mkdir -p proto
cp -r ../../pb/* ./proto

# [END gke_currencyservice_genproto]
8 changes: 6 additions & 2 deletions src/emailservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,4 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_emailservice_genproto]

python -m grpc_tools.protoc -I../../pb --python_out=. --grpc_python_out=. ../../pb/demo.proto

# [END gke_emailservice_genproto]
8 changes: 6 additions & 2 deletions src/frontend/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_frontend_genproto]

PATH=$PATH:$GOPATH/bin
protodir=../../pb

protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto

# [END gke_frontend_genproto]
8 changes: 6 additions & 2 deletions src/paymentservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_paymentservice_genproto]

# protos are loaded dynamically for node, simply copies over the proto.
mkdir -p proto
cp -r ../../pb/* ./proto

# [END gke_paymentservice_genproto]
8 changes: 6 additions & 2 deletions src/productcatalogservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_productcatalogservice_genproto]

PATH=$PATH:$GOPATH/bin
protodir=../../pb

protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto

# [END gke_productcatalogservice_genproto]
7 changes: 5 additions & 2 deletions src/recommendationservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash -eu
#
# Copyright 2018 Google LLC
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,9 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_recommendationservice_genproto]

# script to compile python protos
#
# requires gRPC tools:
# pip install -r requirements.txt

python -m grpc_tools.protoc -I../../pb --python_out=. --grpc_python_out=. ../../pb/demo.proto

# [END gke_recommendationservice_genproto]
6 changes: 5 additions & 1 deletion src/shippingservice/genproto.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -eu
#

# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,7 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_shippingservice_genproto]

PATH=$PATH:$GOPATH/bin
protodir=../../pb

protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto

# [END gke_shippingservice_genproto]