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 8 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
3 changes: 2 additions & 1 deletion 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
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
8 changes: 7 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 All @@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START servicemesh_istio_manifests_allow_egress_googleapis_serviceentry_allow_egress_googleapis]
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
Expand All @@ -27,7 +29,9 @@ spec:
- number: 443
protocol: HTTPS
name: https
# [END servicemesh_istio_manifests_allow_egress_googleapis_serviceentry_allow_egress_googleapis]
---
# [START servicemesh_istio_manifests_allow_egress_googleapis_serviceentry_allow_egress_google_metadata]
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
Expand All @@ -44,3 +48,5 @@ spec:
- number: 443
name: https
protocol: HTTPS
# [END servicemesh_istio_manifests_allow_egress_googleapis_serviceentry_allow_egress_google_metadata]
---
8 changes: 7 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 All @@ -12,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START servicemesh_istio_manifests_frontend_gateway_gateway_frontend_gateway]
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
Expand All @@ -26,7 +28,9 @@ spec:
protocol: HTTP
hosts:
- "*"
# [END servicemesh_istio_manifests_frontend_gateway_gateway_frontend_gateway]
---
# [START servicemesh_istio_manifests_frontend_gateway_virtualservice_frontend_ingress]
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
Expand All @@ -42,3 +46,5 @@ spec:
host: frontend
port:
number: 80
# [END servicemesh_istio_manifests_frontend_gateway_virtualservice_frontend_ingress]
---
3 changes: 3 additions & 0 deletions istio-manifests/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START servicemesh_istio_manifests_frontend_virtualservice_frontend]
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
Expand All @@ -25,3 +26,5 @@ spec:
host: frontend
port:
number: 80
# [END servicemesh_istio_manifests_frontend_virtualservice_frontend]
---
5 changes: 5 additions & 0 deletions kubernetes-manifests/adservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_adservice_deployment_adservice]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue:

I noticed that we're adding region tags to file YAML files in kubernetes-manifests/. All these YAML files get concatenated into one file, release/kubernetes-manifests.yaml, when we create a new release.

So, for instance, this
# [START gke_kubernetes_manifests_adservice_deployment_adservice]
region tag would exist here and in the release/kubernetes-manifests.yaml file.

Will this create any problems (having a region tag show up in two places)?

Copy link
Contributor Author

@xtineskim xtineskim Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooooh good point.
this will cause a problem, since we shouldn't have duplicate region tags (with the same language, in this case yaml)
I'll try to see a workaround, thanks for bringing this up!!
I think the make-release-artifacts.sh can be edited to remove the tags (I don't think we need to have them in the release manifests)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Adding code to remove lines look like # [START ... ] and # [END ... in make-release-artifacts.sh might be the best solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this! I added 2 lines for the kubernetes and istio manifest section.
For example here

sed -i '' '/[^# \[]]/d' "${k8s_manifests_file}" 

finds lines that start with # [ and deletes it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks so much for adding this in. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after discussion with Megan, I edited make-release-artifacts.sh to add region tags around the release/kubernetes-manifests.yaml and the release/istio-manifests.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -58,7 +59,9 @@ spec:
periodSeconds: 15
exec:
command: ["/bin/grpc_health_probe", "-addr=:9555"]
# [END gke_kubernetes_manifests_adservice_deployment_adservice]
---
# [START gke_kubernetes_manifests_adservice_service_adservice]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -71,3 +74,5 @@ spec:
- name: grpc
port: 9555
targetPort: 9555
# [END gke_kubernetes_manifests_adservice_service_adservice]
---
5 changes: 5 additions & 0 deletions kubernetes-manifests/cartservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_cartservice_deployment_cartservice]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -51,7 +52,9 @@ spec:
periodSeconds: 10
exec:
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
# [END gke_kubernetes_manifests_cartservice_deployment_cartservice]
---
# [START gke_kubernetes_manifests_cartservice_service_cartservice]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -64,3 +67,5 @@ spec:
- name: grpc
port: 7070
targetPort: 7070
# [END gke_kubernetes_manifests_cartservice_service_cartservice]
---
5 changes: 5 additions & 0 deletions kubernetes-manifests/checkoutservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_checkoutservice_deployment_checkoutservice]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -67,7 +68,9 @@ spec:
limits:
cpu: 200m
memory: 128Mi
# [END gke_kubernetes_manifests_checkoutservice_deployment_checkoutservice]
---
# [START gke_kubernetes_manifests_checkoutservice_service_checkoutservice]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -80,3 +83,5 @@ spec:
- name: grpc
port: 5050
targetPort: 5050
# [END gke_kubernetes_manifests_checkoutservice_service_checkoutservice]
---
5 changes: 5 additions & 0 deletions kubernetes-manifests/currencyservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_currencyservice_deployment_currencyservice]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -55,7 +56,9 @@ spec:
limits:
cpu: 200m
memory: 128Mi
# [END gke_kubernetes_manifests_currencyservice_deployment_currencyservice]
---
# [START gke_kubernetes_manifests_currencyservice_service_currencyservice]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -68,3 +71,5 @@ spec:
- name: grpc
port: 7000
targetPort: 7000
# [END gke_kubernetes_manifests_currencyservice_service_currencyservice]
---
5 changes: 5 additions & 0 deletions kubernetes-manifests/emailservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_emailservice_deployment_emailservice]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -54,7 +55,9 @@ spec:
limits:
cpu: 200m
memory: 128Mi
# [END gke_kubernetes_manifests_emailservice_deployment_emailservice]
---
# [START gke_kubernetes_manifests_emailservice_service_emailservice]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -67,3 +70,5 @@ spec:
- name: grpc
port: 5000
targetPort: 8080
# [END gke_kubernetes_manifests_emailservice_service_emailservice]
---
7 changes: 7 additions & 0 deletions kubernetes-manifests/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_frontend_deployment_frontend]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -85,7 +86,9 @@ spec:
limits:
cpu: 200m
memory: 128Mi
# [END gke_kubernetes_manifests_frontend_deployment_frontend]
---
# [START gke_kubernetes_manifests_frontend_service_frontend]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -98,7 +101,9 @@ spec:
- name: http
port: 80
targetPort: 8080
# [END gke_kubernetes_manifests_frontend_service_frontend]
---
# [START gke_kubernetes_manifests_frontend_service_frontend_external]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -111,3 +116,5 @@ spec:
- name: http
port: 80
targetPort: 8080
# [END gke_kubernetes_manifests_frontend_service_frontend_external]
---
4 changes: 4 additions & 0 deletions kubernetes-manifests/loadgenerator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# 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.

# [START gke_kubernetes_manifests_loadgenerator_deployment_loadgenerator]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -61,3 +63,5 @@ spec:
limits:
cpu: 500m
memory: 512Mi
# [END gke_kubernetes_manifests_loadgenerator_deployment_loadgenerator]
---
5 changes: 5 additions & 0 deletions kubernetes-manifests/paymentservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gke_kubernetes_manifests_paymentservice_deployment_paymentservice]
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -54,7 +55,9 @@ spec:
limits:
cpu: 200m
memory: 128Mi
# [END gke_kubernetes_manifests_paymentservice_deployment_paymentservice]
---
# [START gke_kubernetes_manifests_paymentservice_service_paymentservice]
apiVersion: v1
kind: Service
metadata:
Expand All @@ -67,3 +70,5 @@ spec:
- name: grpc
port: 50051
targetPort: 50051
# [END gke_kubernetes_manifests_paymentservice_service_paymentservice]
---
Loading