From f2e4cfaf11d87022bb17ef5b89be01ad92404b47 Mon Sep 17 00:00:00 2001 From: cartersocha Date: Mon, 16 May 2022 14:15:29 -0700 Subject: [PATCH 1/6] update boutique --- CODE_OF_CONDUCT.md | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 497c36b4f7..0000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,44 +0,0 @@ -# Contributor Code of Conduct - -As contributors and maintainers of this project, -and in the interest of fostering an open and welcoming community, -we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. - -We are committed to making participation in this project -a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, -such as physical or electronic -addresses, without explicit permission -* Other unethical or unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct. -By adopting this Code of Conduct, -project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. -Project maintainers who do not follow or enforce the Code of Conduct -may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior -may be reported by opening an issue -or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor -Covenant](http://contributor-covenant.org), version 1.2.0, available at -[http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) From a8a31626cadc5aaf74153cf7d7b0a0c56b96632d Mon Sep 17 00:00:00 2001 From: cartersocha Date: Mon, 16 May 2022 14:17:45 -0700 Subject: [PATCH 2/6] remove files --- README.md | 108 +-- cloudbuild.yaml | 39 - docs/cloudshell-tutorial.md | 161 ---- docs/cymbal-shops.md | 28 - docs/development-guide.md | 138 ---- docs/development-principles.md | 45 -- docs/gcp-instrumentation.md | 38 - docs/memorystore.md | 103 --- docs/service-mesh.md | 64 -- docs/workload-identity.md | 63 -- hack/README.md | 67 -- hack/build-and-run.sh | 143 ---- hack/kill-containers.sh | 19 - hack/license_header.txt | 13 - hack/make-docker-images.sh | 47 -- hack/make-release-artifacts.sh | 101 --- hack/make-release.sh | 52 -- istio-manifests/allow-egress-googleapis.yaml | 46 -- istio-manifests/frontend-gateway.yaml | 44 - istio-manifests/frontend.yaml | 27 - kubernetes-manifests/README.md | 8 - kubernetes-manifests/adservice.yaml | 71 -- kubernetes-manifests/cartservice.yaml | 70 -- kubernetes-manifests/checkoutservice.yaml | 78 -- kubernetes-manifests/currencyservice.yaml | 68 -- kubernetes-manifests/emailservice.yaml | 69 -- kubernetes-manifests/frontend.yaml | 111 --- kubernetes-manifests/jaeger.yaml | 88 -- kubernetes-manifests/loadgenerator.yaml | 63 -- kubernetes-manifests/otelcollector.yaml | 60 -- kubernetes-manifests/paymentservice.yaml | 67 -- .../productcatalogservice.yaml | 67 -- .../recommendationservice.yaml | 71 -- kubernetes-manifests/redis.yaml | 66 -- kubernetes-manifests/shippingservice.yaml | 67 -- release/istio-manifests.yaml | 96 --- release/kubernetes-manifests.yaml | 749 ------------------ skaffold.yaml | 111 --- 38 files changed, 4 insertions(+), 3322 deletions(-) delete mode 100644 cloudbuild.yaml delete mode 100644 docs/cloudshell-tutorial.md delete mode 100644 docs/cymbal-shops.md delete mode 100644 docs/development-guide.md delete mode 100644 docs/development-principles.md delete mode 100644 docs/gcp-instrumentation.md delete mode 100644 docs/memorystore.md delete mode 100644 docs/service-mesh.md delete mode 100644 docs/workload-identity.md delete mode 100644 hack/README.md delete mode 100644 hack/build-and-run.sh delete mode 100644 hack/kill-containers.sh delete mode 100644 hack/license_header.txt delete mode 100644 hack/make-docker-images.sh delete mode 100644 hack/make-release-artifacts.sh delete mode 100644 hack/make-release.sh delete mode 100644 istio-manifests/allow-egress-googleapis.yaml delete mode 100644 istio-manifests/frontend-gateway.yaml delete mode 100644 istio-manifests/frontend.yaml delete mode 100644 kubernetes-manifests/README.md delete mode 100644 kubernetes-manifests/adservice.yaml delete mode 100644 kubernetes-manifests/cartservice.yaml delete mode 100644 kubernetes-manifests/checkoutservice.yaml delete mode 100644 kubernetes-manifests/currencyservice.yaml delete mode 100644 kubernetes-manifests/emailservice.yaml delete mode 100644 kubernetes-manifests/frontend.yaml delete mode 100644 kubernetes-manifests/jaeger.yaml delete mode 100644 kubernetes-manifests/loadgenerator.yaml delete mode 100644 kubernetes-manifests/otelcollector.yaml delete mode 100644 kubernetes-manifests/paymentservice.yaml delete mode 100644 kubernetes-manifests/productcatalogservice.yaml delete mode 100644 kubernetes-manifests/recommendationservice.yaml delete mode 100644 kubernetes-manifests/redis.yaml delete mode 100644 kubernetes-manifests/shippingservice.yaml delete mode 100644 release/istio-manifests.yaml delete mode 100644 release/kubernetes-manifests.yaml delete mode 100644 skaffold.yaml diff --git a/README.md b/README.md index 325ba362b0..c0aefa8c2c 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,9 @@ --- -## This repo was modified and it is used to demonstrate OpenTelemetry capabilities +## Under Construction -All the services had their OpenCensus, Cloud Operations (Stackdriver) removed. -Only OpenTelemetry Traces were added. - ---- - -**Online Boutique** is a cloud-native microservices demo application. Online -Boutique consists of a 10-tier microservices application + 1 Load Generator. The -application is a web-based e-commerce app where users can browse items, add them -to the cart, and purchase them. - -**Google uses the original application to demonstrate use of technologies like -Kubernetes/GKE, Istio, Stackdriver, gRPC and OpenCensus**. This application -works on any Kubernetes cluster, as well as Google Kubernetes Engine. It’s -**easy to deploy with little to no configuration**. You can find the one used by -Google here: - -If you’re using this demo, please **★Star** this repository to show your -interest! +This repo is a work in progress ## Screenshots from the Online Boutique @@ -39,78 +22,6 @@ interest! | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | [![Screenshot of Jaeger UI](./docs/img/jaeger-ui.png)](./docs/img/jaeger-ui.png) | [![Screenshot of Trace View](./docs/img/jaeger-trace-view.png)](./docs/img/jaeger-trace-view.png) | -## Quickstart (GKE) - -If you'd like to follow Google's quickstart to deploy the sample in GKE, please refer to [the original repository](https://github.com/GoogleCloudPlatform/microservices-demo#quickstart-gke). -This repository will work with skaffold in the same way. - -## Quickstart (Local with Docker) - -**Docker is required.** -If you want to test it locally without a kubernetes cluster, you can follow the steps below. - -1. **Clone this repository.** - -``` -git clone https://github.com/julianocosta89/opentelemetry-microservices-demo.git -cd opentelemetry-microservices-demo -``` - -1. **Build and run the containers.** - -We can simply use the script [hack/build-and-run.sh.](hack/build-and-run.sh) for this. -The script requires a TAG as parameter to build all container images and run them in a docker network called `online-boutique`. - -``` -TAG=1.0.0 ./hack/build-and-run.sh -``` - -1. **Wait for the containers to be ready.** -The first time you run the previous command it takes some minutes to build everything. -Once it finishes, you can check the running containers: - -``` -docker ps -``` - -You should see: - -``` -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -610e1ffb8f3e loadgenerator:1.0.0 "/bin/sh -c 'locust …" 35 seconds ago Up 33 seconds loadgenerator -430b8b64f1f4 shippingservice:1.0.0 "/src/shippingservice" 35 seconds ago Up 34 seconds 0.0.0.0:49162->50051/tcp, :::49162->50051/tcp shippingservice -76d72b930915 recommendationservice:1.0.0 "opentelemetry-instr…" 36 seconds ago Up 35 seconds 0.0.0.0:49161->8080/tcp, :::49161->8080/tcp recommendationservice -70f5946dddff productcatalogservice:1.0.0 "/src/server" 37 seconds ago Up 35 seconds 0.0.0.0:49160->3550/tcp, :::49160->3550/tcp productcatalogservice -261d476b1e11 paymentservice:1.0.0 "node --require ./tr…" 37 seconds ago Up 36 seconds 0.0.0.0:49159->50051/tcp, :::49159->50051/tcp paymentservice -a74930edbb96 frontend:1.0.0 "/src/server" 38 seconds ago Up 37 seconds 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp frontend -b223ca330de7 emailservice:1.0.0 "opentelemetry-instr…" 39 seconds ago Up 38 seconds 0.0.0.0:49158->8080/tcp, :::49158->8080/tcp emailservice -eb3729c0f2d3 currencyservice:1.0.0 "node --require ./tr…" 40 seconds ago Up 38 seconds 0.0.0.0:49157->7000/tcp, :::49157->7000/tcp currencyservice -6178957b18df checkoutservice:1.0.0 "/src/checkoutservice" 40 seconds ago Up 39 seconds 0.0.0.0:49156->5050/tcp, :::49156->5050/tcp checkoutservice -4fb5500e3f01 cartservice:1.0.0 "/app/cartservice" 41 seconds ago Up 40 seconds 0.0.0.0:49155->7070/tcp, :::49155->7070/tcp cartservice -a0f1de606609 adservice:1.0.0 "/app/build/install/…" 41 seconds ago Up 40 seconds 0.0.0.0:49154->9555/tcp, :::49154->9555/tcp adservice -ad06d33dea6d redis:alpine "docker-entrypoint.s…" 42 seconds ago Up 40 seconds 0.0.0.0:49153->6379/tcp, :::49153->6379/tcp redis-cart -0baec02fc020 otelcollector:1.0.0 "/otelcol --config=c…" 42 seconds ago Up 41 seconds 1888/tcp, 4317/tcp, 8888-8889/tcp, 13133/tcp, 55670/tcp, 55678-55679/tcp otelcollector -eb39e7c3ff04 jaegertracing/all-in-one:1.30 "/go/bin/all-in-one-…" 43 seconds ago Up 41 seconds 0.0.0.0:5775->5775/udp, :::5775->5775/udp, 0.0.0.0:5778->5778/tcp, :::5778->5778/tcp, 0.0.0.0:9411->9411/tcp, :::9411->9411/tcp, 0.0.0.0:14250->14250/tcp, :::14250->14250/tcp, 0.0.0.0:14268-14269->14268-14269/tcp, :::14268-14269->14268-14269/tcp, 0.0.0.0:6831-6832->6831-6832/udp, :::6831-6832->6831-6832/udp, 0.0.0.0:16686->16686/tcp, :::16686->16686/tcp jaeger -``` - -1. **Access the web frontend in a browser**: - The frontend will be available at: `http://localhost:8080/`. - -1. **Access Jaeger in a browser to view your traces**: - The Jaeger UI will be available at: `http://localhost:16686/`. - -1. [Optional] **Clean up**: -To kill all containers, simply run [hack/kill-containers.sh.](hack/kill-containers.sh) - -``` -./kill-containers.sh -``` - -## Other Deployment Options - -If you'd like to check other deployment options, please refer to [the original -repository](https://github.com/GoogleCloudPlatform/microservices-demo#other-deployment-options). - ## Architecture **Online Boutique** is composed of 10 microservices written in different @@ -144,8 +55,6 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb). This forked sample can also be executed only with Docker. - **[gRPC](https://grpc.io):** Microservices use a high volume of gRPC calls to communicate to each other. -- **[Istio](https://istio.io):** - Application works on Istio service mesh. - **[OpenTelemetry Traces](https://opentelemetry.io):** All services are instrumented using OpenTelemetry available instrumentation libraries. - **[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/getting-started):** @@ -154,26 +63,17 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb). logs and to Jaeger. - **[Jager](https://www.jaegertracing.io):** All generated traces are being sent to Jaeger. -- **[Skaffold](https://skaffold.dev):** - Application is deployed to Kubernetes with a single command using Skaffold. - **Synthetic Load Generation:** The application demo comes with a background job that creates realistic usage patterns on the website using [Locust](https://locust.io/) load generator. ## Local Development -If you would like to contribute features or fixes to this app, see the -[Development Guide](/docs/development-guide.md) on how to build this demo -locally. +TBD ## Demos featuring Online Boutique -Check out Google's [Demos featuring Online -Boutique](https://github.com/GoogleCloudPlatform/microservices-demo#demos-featuring-online-boutique) - ---- - -This is not an official Google project. +TBD ## Contributing diff --git a/cloudbuild.yaml b/cloudbuild.yaml deleted file mode 100644 index 72ff1d017a..0000000000 --- a/cloudbuild.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed 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. - -# This configuration file is used to build and deploy the app into a -# GKE cluster using Google Cloud Build. -# -# PREREQUISITES: -# - Cloud Build service account must have role: "Kubernetes Engine Developer" - -# USAGE: -# GCP zone and GKE target cluster must be specified as substitutions -# Example invocation: -# `gcloud builds submit --config=cloudbuild.yaml --substitutions=_ZONE=us-central1-b,_CLUSTER=demo-app-staging .` - -steps: -- id: 'Deploy application to cluster' - name: 'gcr.io/k8s-skaffold/skaffold:v0.20.0' - entrypoint: 'bash' - args: - - '-c' - - > - gcloud container clusters get-credentials --zone=$_ZONE $_CLUSTER; - skaffold run -f=skaffold.yaml --default-repo=gcr.io/$PROJECT_ID; - -# Add more power, and more time, for heavy Skaffold build -timeout: '3600s' -options: - machineType: 'N1_HIGHCPU_8' diff --git a/docs/cloudshell-tutorial.md b/docs/cloudshell-tutorial.md deleted file mode 100644 index d2ac1a454b..0000000000 --- a/docs/cloudshell-tutorial.md +++ /dev/null @@ -1,161 +0,0 @@ -# Online Boutique - -This tutorial shows you how to deploy the cloud-native microservices demo -application **[Online -Boutique](https://github.com/GoogleCloudPlatform/microservices-demo)** to a -Kubernetes cluster. - -You'll be able to run Online Boutique on: - -- a free [minikube](https://minikube.sigs.k8s.io/docs/) cluster, which comes - built in to the Cloud Shell instance -- a [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine) - cluster using a new or existing [Google Cloud Platform - project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) - -Let's get started! - -## Kubernetes cluster setup - -Set up a Kubernetes cluster using the instructions below for either **minikube** -or **GKE**. - ---- - -### Minikube instructions - -Minikube creates a local Kubernetes cluster on Cloud Shell. - -1. Click minikube on - the status bar located at the bottom of the editor window. - -1. The command palette will prompt you to choose which minikube cluster to - control. Select **minikube** and, in the next prompt, click **Start** if the - cluster has not already been started. - -1. If prompted, authorize Cloud Shell to make a GCP API call with your credentials. - -*It may take a few minutes for minikube to finish starting.* - -Once minikube has started, you're ready to move on to the next step. - ---- - -### GKE instructions - -In order to create a GKE cluster, you'll need to **[create a Google Cloud -Platform -project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project)** -or use an existing project. - -1. Access the command palette by going to **View > Find Command**. - -1. Run the command **"Cloud Code: Create GKE cluster"**. - -1. Select your GCP project. - -1. Apply the following configurations in the GKE wizard: -> -> - Zone: us-central1-b -> - Cluster name: onlineboutique -> - Node count: 4 -> - Machine type: e2-standard-2 - -1. Click **Create Cluster**. Once your cluster has been created successfully, - you can move on to the next step. - -## Run on Kubernetes - -Now you can run Online Boutique on your Kubernetes cluster! - -1. Launch the Cloud Code - menu from the status bar and select - Run on - Kubernetes. - -1. If prompted to select a Skaffold Profile, select **[default]**. - -1. Select **Yes** to confirm your current context. - -1. If you're using a GKE cluster, you'll need to confirm your container image - registry. - -1. If prompted, authorize Cloud Shell to make a GCP API call with your - credentials. - -Cloud Code uses configurations defined in skaffold.yaml to build -and deploy the app. *It may take a few minutes for the deploy to complete.* - -1. Once the app is running, the local URLs will be displayed in the - Output terminal. - -1. To access your Online Boutique frontend service, click on the - Web Preview button in the - upper right of the editor window. - -1. Select **Change Port** and enter '4503' as the port, then click **Change and - Preview**. Your app will open in a new window. - -## Stop the app - -To stop running the app: - -1. Go to the Debug view - -2. Click the 'Stop' icon. 🟥 - -3. Select **Yes** to clean up deployed resources. - -You can start, stop, and debug apps from the Debug view. - -### Clean up - -If you've deployed your app to a GKE cluster in your Google Cloud Platform -project, you'll want to delete the cluster to avoid incurring charges. - -1. Navigate to the Cloud Code - Kubernetes - view in the Activity bar. - -2. Under the Google Kubernetes Engine Explorer - tab, right-click on your cluster and select - **Delete Cluster**. - -## Conclusion - - - -Congratulations! You've successfully deployed Online Boutique using Cloud Shell. - - - -### What's next? - -Try other deployment options for Online Boutique: - -- **Workload Identity**: See these - instructions. -- **Istio**: See - these instructions. -- **Anthos Service Mesh**: ASM requires Workload Identity to be enabled in your - GKE cluster. See these - instructions to configure and deploy the app. - Then, use the service mesh - guide. -- **Memorystore**: See these - instructions to replace the in-cluster `redis` - database with hosted Google Cloud Memorystore (redis). - -Learn more about the [Cloud Shell](https://cloud.google.com/shell) IDE -environment and the [Cloud Code](https://cloud.google.com/code) extension. diff --git a/docs/cymbal-shops.md b/docs/cymbal-shops.md deleted file mode 100644 index f849506dce..0000000000 --- a/docs/cymbal-shops.md +++ /dev/null @@ -1,28 +0,0 @@ -# Cymbal Shops Branding - -By default, when you deploy this sample app, the "Online Boutique" branding -(logo and wording) will be used. But you may want to use Google Cloud's -fictitious company, _Cymbal Shops_, instead. - -To use "Cymbal Shops" branding, set the `CYMBAL_BRANDING` environment variable -to `"true"` in the the Kubernetes manifest (`.yaml`) for the `frontend` -Deployment. - -``` -apiVersion: apps/v1 -kind: Deployment -metadata: - name: frontend -spec: - ... - template: - ... - spec: - ... - containers: - ... - env: - ... - - name: CYMBAL_BRANDING - value: "true" -``` diff --git a/docs/development-guide.md b/docs/development-guide.md deleted file mode 100644 index 569fbfc249..0000000000 --- a/docs/development-guide.md +++ /dev/null @@ -1,138 +0,0 @@ -# Development Guide - -This doc explains how to build and run the OnlineBoutique source code locally -using the `skaffold` command-line tool. - -## Prerequisites - -- [Docker for Desktop](https://www.docker.com/products/docker-desktop). -- kubectl (can be installed via `gcloud components install kubectl`) -- [skaffold **1.27+**](https://skaffold.dev/docs/install/) (latest version - recommended), a tool that builds and deploys Docker images in bulk. -- A Google Cloud Project with Google Container Registry enabled. -- Enable GCP APIs for Cloud Monitoring, Tracing, Debugger, Profiler: - -``` -gcloud services enable monitoring.googleapis.com \ - cloudtrace.googleapis.com \ - clouddebugger.googleapis.com \ - cloudprofiler.googleapis.com -``` - -- [Minikube](https://minikube.sigs.k8s.io/docs/start/) (optional - see Local - Cluster) -- [Kind](https://kind.sigs.k8s.io/) (optional - see Local Cluster) - -## Option 1: Google Kubernetes Engine (GKE) - -> 💡 Recommended if you're using Google Cloud Platform and want to try it on a -> realistic cluster. **Note**: If your cluster has Workload Identity enabled, -> [see these instructions](/docs/workload-identity.md) - -1. Create a Google Kubernetes Engine cluster and make sure `kubectl` is pointing - to the cluster. - - ```sh - gcloud services enable container.googleapis.com - ``` - - ```sh - gcloud container clusters create demo --enable-autoupgrade \ - --enable-autoscaling --min-nodes=3 --max-nodes=10 --num-nodes=5 --zone=us-central1-a - ``` - - ``` - kubectl get nodes - ``` - -2. Enable Google Container Registry (GCR) on your GCP project and configure the - `docker` CLI to authenticate to GCR: - - ```sh - gcloud services enable containerregistry.googleapis.com - ``` - - ```sh - gcloud auth configure-docker -q - ``` - -3. In the root of this repository, run `skaffold run - --default-repo=gcr.io/[PROJECT_ID]`, where [PROJECT_ID] is your GCP project - ID. - - This command: - - - builds the container images - - pushes them to GCR - - applies the `./kubernetes-manifests` deploying the application to - Kubernetes. - - **Troubleshooting:** If you get "No space left on device" error on Google - Cloud Shell, you can build the images on Google Cloud Build: [Enable the - Cloud Build - API](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com), - then run `skaffold run -p gcb --default-repo=gcr.io/[PROJECT_ID]` instead. - -4. Find the IP address of your application, then visit the application on your - browser to confirm installation. - - ``` - kubectl get service frontend-external - ``` - -## Option 2 - Local Cluster - -1. Launch a local Kubernetes cluster with one of the following tools: - - - To launch **Minikube** (tested with Ubuntu Linux). Please, ensure that the - local Kubernetes cluster has at least: - - 4 CPUs - - 4.0 GiB memory - - 32 GB disk space - - ```shell - minikube start --cpus=4 --memory 4096 --disk-size 32g - ``` - - - To launch **Docker for Desktop** (tested with Mac/Windows). Go to - Preferences: - - choose “Enable Kubernetes”, - - set CPUs to at least 3, and Memory to at least 6.0 GiB - - on the "Disk" tab, set at least 32 GB disk space - - - To launch a **Kind** cluster: - - ```shell - kind create cluster - ``` - -2. Run `kubectl get nodes` to verify you're connected to the respective control - plane. - -3. Run `skaffold run` (first time will be slow, it can take ~20 minutes). This - will build and deploy the application. If you need to rebuild the images - automatically as you refactor the code, run `skaffold dev` command. - -4. Run `kubectl get pods` to verify the Pods are ready and running. - -5. Access the web frontend through your browser - - **Minikube** requires you to run a command to access the frontend service: - - ```shell - minikube service frontend-external - ``` - - - **Docker For Desktop** should automatically provide the frontend at - - - - **Kind** does not provision an IP address for the service. You must run a - port-forwarding process to access the frontend at : - - ```shell - kubectl port-forward deployment/frontend 8080:8080 - ``` - -## Cleanup - -If you've deployed the application with `skaffold run` command, you can run -`skaffold delete` to clean up the deployed resources. diff --git a/docs/development-principles.md b/docs/development-principles.md deleted file mode 100644 index 48a16225b2..0000000000 --- a/docs/development-principles.md +++ /dev/null @@ -1,45 +0,0 @@ -# Development Principles - -> **Note:** This document outlines guidances behind some development decisions -> behind the Online Boutique demo application. - -## Minimal configuration - -Running the demo locally or on GCP should require minimal to no configuration -unless absolutely necessary to run critical parts of the demo. - -Configuration that takes multiple steps, especially such as creating service -accounts should be avoided. - -## App must work well outside GCP - -Demo application should work reasonably well when it is not deployed to GCP -services. The experience of running the application locally or on GCP should be -close. - -For example: - -- OpenCensus prints the traces to stdout when it cannot connect to GCP. -- Stackdriver Debugging tries connecting to GCP multiple times, eventually gives - up. - -## Running on GCP must not reduce functionality - -Running the demo on the GCP must not reduce/lose any of the capabilities -developers have when running locally. - -For example: Logs should still be printed to stdout/stderr even though logs are -uploaded to Stackdriver Logging when on GCP, so that developers can use "kubectl -logs" to diagnose each container. - -## Microservice implementations should not be complex - -Each service should provide a minimal implementation and try to avoid -unnecessary code and logic that's not executed. - -Keep in mind that any service implementation is a decent example of “a GRPC -application that runs on Kubernetes”. Keeping the source code short and -navigable will serve this purpose. - -It is okay to have intentional inefficiencies in the code as they help -illustrate the capabilities of profiling and diagnostics offerings. diff --git a/docs/gcp-instrumentation.md b/docs/gcp-instrumentation.md deleted file mode 100644 index 0bd3d6c71f..0000000000 --- a/docs/gcp-instrumentation.md +++ /dev/null @@ -1,38 +0,0 @@ -# Integrating Online Boutique with Google Cloud - -By default, [Google Cloud -Operations](https://cloud.google.com/products/operations) instrumentation is -**turned off** for Online Boutique deployments. This includes Monitoring -(Stats), Tracing, Profiler, and Debugger. This means that even if you're running -this app on [GKE](https://cloud.google.com/kubernetes-engine), traces (for -example) will not be exported to [Google Cloud -Trace](https://cloud.google.com/trace). - -You can see the instrumentation status in your deployment by opening one of the -Deployment YAML files and seeing: - -```YAML -- name: DISABLE_STATS -value: "1" -- name: DISABLE_TRACING -value: "1" -- name: DISABLE_PROFILER -value: "1" -``` - -If you **are** running this app on GKE, and want to re-enable Google Cloud -Operations instrumentation, set one or more of the `DISABLE_STATS`, -`DISABLE_TRACING`, etc. fields to `0`. This re-enables the integrations. You can -re-enable some or all of these integrations, for some or all Online Boutique -services. Note that you will accumulate Google Cloud Operations -[billing](https://cloud.google.com/stackdriver/pricing) if you re-enable these -fields. - -```YAML -- name: DISABLE_STATS -value: "0" -- name: DISABLE_TRACING -value: "0" -- name: DISABLE_PROFILER -value: "0" -``` diff --git a/docs/memorystore.md b/docs/memorystore.md deleted file mode 100644 index 076a8bc754..0000000000 --- a/docs/memorystore.md +++ /dev/null @@ -1,103 +0,0 @@ -# Memorystore (redis) + OnlineBoutique - -This guide contains instructions for overriding the default in-cluster `redis` -database for `cartservice` with Memorystore (redis). - -Important notes: - -- You can connect to a Memorystore (redis) instance from GKE clusters that are - in the same region and use the same network as your instance. -- You cannot connect to a Memorystore (redis) instance from a GKE cluster - without VPC-native/IP aliasing enabled. - -![Architecture diagram with Memorystore](./img/memorystore.png) - -## Steps - -1. Create a GKE cluster with VPC-native/IP aliasing enabled. - -```sh -PROJECT_ID="" -ZONE="" -REGION="" - -gcloud container clusters create onlineboutique \ - --project=${PROJECT_ID} \ - --zone=${ZONE} \ - --machine-type=e2-standard-2 \ - --enable-ip-alias -``` - -1. Enable the Memorystore (redis) service on your project. - -```sh -gcloud services enable redis.googleapis.com --project=${PROJECT_ID} -``` - -1. Create the Memorystore (redis) instance. - -```sh -gcloud redis instances create redis-cart --size=1 --region=${REGION} --zone=${ZONE} --redis-version=redis_6_x --project=${PROJECT_ID} -``` - -After a few minutes, you will see the `STATUS` as `READY` when your Memorystore -instance will be successfully provisioned: - -```sh -gcloud redis instances list --region ${REGION} -``` - -1. Update current manifests to target this Memorystore (redis) instance. - -```sh -cp ./release/kubernetes-manifests.yaml ./release/updated-manifests.yaml -REDIS_IP=$(gcloud redis instances describe redis-cart --region=${REGION} --format='get(host)') -sed -i "s/value: \"redis-cart:6379\"/value: \"${REDIS_IP}\"/g" ./release/updated-manifests.yaml -``` - -In addition, in the `./release/updated-manifests.yaml` file you need also to -manually remove the `Deployment` and `Service` sections of the `redis-cart` -which are not needed anymore. - -1. Apply all the updated manifests. - -```sh -kubectl apply -f ./release/updated-manifests.yaml -``` - -1. **Wait for the Pods to be ready.** - -```sh -kubectl get pods -``` - -After a few minutes, you should see: - -```sh -NAME READY STATUS RESTARTS AGE -adservice-76bdd69666-ckc5j 1/1 Running 0 2m58s -cartservice-66d497c6b7-dp5jr 1/1 Running 0 2m59s -checkoutservice-666c784bd6-4jd22 1/1 Running 0 3m1s -currencyservice-5d5d496984-4jmd7 1/1 Running 0 2m59s -emailservice-667457d9d6-75jcq 1/1 Running 0 3m2s -frontend-6b8d69b9fb-wjqdg 1/1 Running 0 3m1s -loadgenerator-665b5cd444-gwqdq 1/1 Running 0 3m -paymentservice-68596d6dd6-bf6bv 1/1 Running 0 3m -productcatalogservice-557d474574-888kr 1/1 Running 0 3m -recommendationservice-69c56b74d4-7z8r5 1/1 Running 0 3m1s -shippingservice-6ccc89f8fd-v686r 1/1 Running 0 2m58s -``` - -1. **Access the web frontend in a browser** using the frontend's `EXTERNAL_IP`. - -```sh -kubectl get service frontend-external | awk '{print $4}' -``` - -**Note**- you may see `` while GCP provisions the load balancer. If -this happens, wait a few minutes and re-run the command. - -## Resources - -- [Connecting to a Redis instance from a Google Kubernetes Engine - cluster](https://cloud.google.com/memorystore/docs/redis/connect-redis-instance-gke) diff --git a/docs/service-mesh.md b/docs/service-mesh.md deleted file mode 100644 index 03f0cf4092..0000000000 --- a/docs/service-mesh.md +++ /dev/null @@ -1,64 +0,0 @@ -# Deploying to an Istio-enabled cluster - -This repository provides an [`istio-manifests`](/istio-manifests) directory -containing ingress resources (an Istio `Gateway` and `VirtualService`) needed to -expose the app frontend running inside a Kubernetes cluster. - -You can apply these resources to your cluster in addition to the -`kubernetes-manifests`, then use the Istio IngressGateway's external IP to view -the app frontend. See the following instructions for Istio steps. - -## Steps - -1. Create a GKE cluster with at least 4 nodes, machine type `e2-standard-4`. - -```sh -PROJECT_ID="" -ZONE="" - -gcloud container clusters create onlineboutique \ - --project=${PROJECT_ID} --zone=${ZONE} \ - --machine-type=e2-standard-4 --num-nodes=4 -``` - -1. [Install Istio](https://istio.io/latest/docs/setup/getting-started/) on your - cluster. - -1. Enable Istio sidecar proxy injection in the `default` Kubernetes namespace. - -```sh -kubectl label namespace default istio-injection=enabled -``` - -1. Apply all the manifests in the `/release` directory. This includes the Istio - and Kubernetes manifests. - -```sh -kubectl apply -f ./release -``` - -1. Run `kubectl get pods` to see pods are in a healthy and ready state. - -1. Find the IP address of your Istio gateway Ingress or Service, and visit the - application frontend in a web browser. - -```sh -INGRESS_HOST="$(kubectl -n istio-system get service istio-ingressgateway \ - -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" -echo "$INGRESS_HOST" -``` - -```sh -curl -v "http://$INGRESS_HOST" -``` - -## Additional service mesh demos using OnlineBoutique - -- [Canary - deployment](https://github.com/GoogleCloudPlatform/istio-samples/tree/master/istio-canary-gke) -- [Security (mTLS, JWT, - Authorization)](https://github.com/GoogleCloudPlatform/istio-samples/tree/master/security-intro) -- [Cloud Operations - (Stackdriver)](https://github.com/GoogleCloudPlatform/istio-samples/tree/master/istio-stackdriver) -- [Stackdriver metrics (Open source - Istio)](https://github.com/GoogleCloudPlatform/istio-samples/tree/master/stackdriver-metrics) diff --git a/docs/workload-identity.md b/docs/workload-identity.md deleted file mode 100644 index 4ee2d82158..0000000000 --- a/docs/workload-identity.md +++ /dev/null @@ -1,63 +0,0 @@ -# Setup for Workload Identity clusters - -If you have enabled [Workload -Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) -on your GKE cluster ([a requirement for Anthos Service -Mesh](https://cloud.google.com/service-mesh/docs/gke-anthos-cli-new-cluster#requirements)), -follow these instructions to ensure that OnlineBoutique pods can communicate -with GCP APIs. - -*Note* - These instructions have only been validated in GKE on GCP clusters. -[Workload Identity is not yet -supported](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#creating_a_relationship_between_ksas_and_gsas) -in Anthos GKE on Prem. - -1. **Set up Workload Identity** on your GKE cluster [using the instructions - here](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#enable_on_new_cluster). - These instructions create the Kubernetes Service Account (KSA) and Google - Service Account (GSA) that the OnlineBoutique pods will use to authenticate - to GCP. Take note of what Kubernetes `namespace` you use during setup. - -1. **Add IAM Roles** to your GSA. These roles allow workload identity-enabled - OnlineBoutique pods to send traces and metrics to GCP. - -```bash -PROJECT_ID= -GSA_NAME= - -gcloud projects add-iam-policy-binding ${PROJECT_ID} \ - --member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \ - --role roles/cloudtrace.agent - -gcloud projects add-iam-policy-binding ${PROJECT_ID} \ - --member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \ - --role roles/monitoring.metricWriter - -gcloud projects add-iam-policy-binding ${PROJECT_ID} \ - --member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \ - --role roles/cloudprofiler.agent - -gcloud projects add-iam-policy-binding ${PROJECT_ID} \ - --member "serviceAccount:${GSA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com" \ - --role roles/clouddebugger.agent -``` - -1. **Generate OnlineBoutique manifests** using your KSA as the Pod service - account. In `kubernetes-manifests/`, replace `serviceAccountName: default` - with the name of your KSA. (**Note** - sample below is Bash.) - -```bash - -KSA_NAME= -sed "s/serviceAccountName: default/serviceAccountName: ${KSA_NAME}/g" release/kubernetes-manifests.yaml > release/wi-kubernetes-manifests.yaml -done -``` - -1. **Deploy OnlineBoutique** to your GKE cluster using the install instructions - above, except make sure that instead of the default namespace, you're - deploying the manifests into your KSA namespace: - -```bash -NAMESPACE= -kubectl apply -n ${NAMESPACE} -f release/wi-kubernetes-manifests.yaml -``` diff --git a/hack/README.md b/hack/README.md deleted file mode 100644 index 362cc89922..0000000000 --- a/hack/README.md +++ /dev/null @@ -1,67 +0,0 @@ -## `hack/` - -This directory contains the scripts for creating a new `microservices-demo` release. - -### Create a New Release - -#### 1. Decide on the next release version number using [semantic versioning](https://semver.org/). -- Look at the [commits since the previous release](https://github.com/GoogleCloudPlatform/microservices-demo/commits/main). - -#### 2. Open a new terminal. - -#### 3. Make sure you have `gsed` installed. If not, `brew install gnu-sed`. - -#### 4. Set the following environment variables: - -- `TAG` - This is the new version (e.g., `v0.3.5`). -- `REPO_PREFIX` - This is the Docker repository. -##### Example: -``` -export TAG=v0.3.5 -export REPO_PREFIX=gcr.io/google-samples/microservices-demo -``` - -#### 5. Run `./hack/make-release.sh`. - -- Make sure you run `./hack/make-release.sh` from this project's root folder — **not** from inside the `hack/` folder. -- This script: - 1. uses `make-docker-images.sh` to build and push a Docker image for each microservice to the previously specified repository. - 1. uses `make-release-artifacts.sh` to regenerates (and update the image $TAGS) YAML file at `./release/kubernetes-manifests.yaml`. - 1. runs `git tag` and pushes a new branch (e.g., `release/v0.3.5`) with the changes to `release/kubernetes-manifests.yaml`. - -#### 6. Make sure the new Docker images were created and pushed. - -- Go through [our Container Registry repository](https://pantheon.corp.google.com/gcr/images/google-samples/global/microservices-demo?project=google-samples). -- Make sure a Docker image was created for each microservice (with the new version tag). - - -#### 8. [Draft a new release on GitHub](https://github.com/GoogleCloudPlatform/microservices-demo/releases). - -- Summarize the [commits since the previous release](https://github.com/GoogleCloudPlatform/microservices-demo/commits/main). -- See previous releases for inspiration on release notes. - -#### 7. Create a new pull-request. - -- When you ran `make-release.sh`, it created a new branch (e.g., `release/v0.3.5`). -- Include the new release draft in the pull-request description for reviewers to see. - -#### 8. Once your pull-request is approved, merge it. - -#### 9. Connect to our [online-boutique-release GKE cluster](https://pantheon.corp.google.com/kubernetes/clusters/details/us-central1-c/online-boutique-release/details?project=online-boutique-ci) - -- To do this, you can use: -``` -gcloud container clusters get-credentials online-boutique-release \ - --zone us-central1-c --project online-boutique-ci -``` - -#### 10. Deploy `release/kubernetes-manifests.yaml` to our [online-boutique-release GKE cluster](https://pantheon.corp.google.com/kubernetes/clusters/details/us-central1-c/online-boutique-release/details?project=online-boutique-ci). - - -``` -kubectl apply -f ./release/kubernetes-manifests.yaml -``` - -#### 11. Make sure [onlineboutique.dev](https://onlineboutique.dev) works. - -#### 12. [Publish your draft release on GitHub](https://github.com/GoogleCloudPlatform/microservices-demo/releases)! diff --git a/hack/build-and-run.sh b/hack/build-and-run.sh deleted file mode 100644 index 454de6e431..0000000000 --- a/hack/build-and-run.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env bash - -# add vx to debug -set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -log() { echo "$1" >&2; } - -# NB: we *want* to split on spaces, so disable this check here -# shellcheck disable=SC2086 -run() { - log "$2" - docker run -d --rm --network=$networkName \ - -e OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=$otelCollector \ - -e OTEL_RESOURCE_ATTRIBUTES=service.name=$containername,service.version=$TAG \ - $1 --name $2 $2:$TAG >&2 || true -} - -check_network() { - echo "Checking if $networkName network exists, if not, it will be created." - for existing_network in $(docker network ls --format '{{.Name}}') - do - if [ "$existing_network" = "$networkName" ] - then - return; - fi - done - - docker network create "$networkName" -} - -TAG="${TAG:?TAG env variable must be specified}" -networkName=online-boutique -otelCollectorName=otelcollector -otelCollector="http://$otelCollectorName:4317" - -check_network - -while IFS= read -d $'\0' -r dir; do - # build image - svcname="$(basename "${dir}")" - builddir="${dir}" - #PR 516 moved cartservice build artifacts one level down to src - if [ "$svcname" == "cartservice" ] - then - builddir="${dir}/src" - fi - image="$svcname:$TAG" - ( - cd "${builddir}" - log "Building: ${image}" - docker build -t "${image}" . - ) -done < <(find "${SCRIPTDIR}/../src" -mindepth 1 -maxdepth 1 -type d -print0) - -log "Successfully built all images." - -log "Deploying Otel-Collector and Jaeger:" - -docker run -d --rm --network="$networkName" --name jaeger \ - -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \ - -p 5775:5775/udp \ - -p 6831:6831/udp \ - -p 6832:6832/udp \ - -p 5778:5778 \ - -p 16686:16686 \ - -p 14250:14250 \ - -p 14268:14268 \ - -p 14269:14269 \ - -p 9411:9411 \ - jaegertracing/all-in-one:1.31 || true - -containername="$otelCollectorName" -docker run -d --rm --network="$networkName" \ - --name "$otelCollectorName" \ - "$otelCollectorName:$TAG" >&2 || true - - -log "Deploying Online Boutique:" - -containername=redis-cart -docker run -d --rm --network="$networkName" \ - -p 6379 -v redis-data:/data \ - --name "$containername" redis:alpine || true - -containername=adservice -run "-p 9555 -e PORT=9555 \ - " "$containername" - -containername=cartservice -run "-p 7070 -e REDIS_ADDR=redis-cart:6379 \ - -e OTEL_EXPORTER_OTLP_ENDPOINT=$otelCollector \ - " "$containername" - -containername=checkoutservice -run "-p 5050 -e PORT=5050 \ - -e PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:3550 \ - -e SHIPPING_SERVICE_ADDR=shippingservice:50051 \ - -e PAYMENT_SERVICE_ADDR=paymentservice:50051 \ - -e EMAIL_SERVICE_ADDR=emailservice:8080 \ - -e CURRENCY_SERVICE_ADDR=currencyservice:7000 \ - -e CART_SERVICE_ADDR=cartservice:7070" "$containername" - -containername=currencyservice -run "-p 7000 -e PORT=7000 \ - " "$containername" - -containername=emailservice -run "-p 8080 -e PORT=8080 \ - -e OTEL_PYTHON_LOG_CORRELATION=true \ - " "$containername" - -containername=frontend -run "-p 8080:8080 -e PORT=8080 \ - -e PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:3550 \ - -e SHIPPING_SERVICE_ADDR=shippingservice:50051 \ - -e CURRENCY_SERVICE_ADDR=currencyservice:7000 \ - -e CART_SERVICE_ADDR=cartservice:7070 \ - -e RECOMMENDATION_SERVICE_ADDR=recommendationservice:8080 \ - -e CHECKOUT_SERVICE_ADDR=checkoutservice:5050 \ - -e AD_SERVICE_ADDR=adservice:9555" "$containername" - -containername=paymentservice -run "-p 50051 -e PORT=50051 \ - " "$containername" - -containername=productcatalogservice -run "-p 3550 -e PORT=3550 \ - " "$containername" - -containername=recommendationservice -run "-p 8080 -e PORT=8080 \ - -e OTEL_PYTHON_LOG_CORRELATION=true \ - -e PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:3550 \ - " "$containername" - -containername=shippingservice -run "-p 50051 -e PORT=50051 \ - " "$containername" - -containername=loadgenerator -run "-e FRONTEND_ADDR=frontend:8080 \ - -e USERS=10" "$containername" diff --git a/hack/kill-containers.sh b/hack/kill-containers.sh deleted file mode 100644 index 91fd51c6a0..0000000000 --- a/hack/kill-containers.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -log() { echo "$1" >&2; } - -while IFS= read -d $'\0' -r dir; do - svcname="$(basename "${dir}")" - log "Killing: ${svcname}" - docker kill "${svcname}" || true - -done < <(find "${SCRIPTDIR}/../src" -mindepth 1 -maxdepth 1 -type d -print0) - -log "Killing: redis-cart" -docker kill redis-cart || true - -log "Killing: jaeger" -docker kill jaeger || true diff --git a/hack/license_header.txt b/hack/license_header.txt deleted file mode 100644 index 2e94f3e551..0000000000 --- a/hack/license_header.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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. diff --git a/hack/make-docker-images.sh b/hack/make-docker-images.sh deleted file mode 100644 index 9cff93701a..0000000000 --- a/hack/make-docker-images.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 Google LLC -# -# Licensed 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. - -# Builds and pushes docker image for each demo microservice. - -set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -log() { echo "$1" >&2; } - -TAG="${TAG:?TAG env variable must be specified}" -REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}" - -while IFS= read -d $'\0' -r dir; do - # build image - svcname="$(basename "${dir}")" - builddir="${dir}" - #PR 516 moved cartservice build artifacts one level down to src - if [ $svcname == "cartservice" ] - then - builddir="${dir}/src" - fi - image="${REPO_PREFIX}/$svcname:$TAG" - ( - cd "${builddir}" - log "Building: ${image}" - docker build -t "${image}" . - - log "Pushing: ${image}" - docker push "${image}" - ) -done < <(find "${SCRIPTDIR}/../src" -mindepth 1 -maxdepth 1 -type d -print0) - -log "Successfully built and pushed all images." diff --git a/hack/make-release-artifacts.sh b/hack/make-release-artifacts.sh deleted file mode 100644 index 10fcb25c8b..0000000000 --- a/hack/make-release-artifacts.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 Google LLC -# -# Licensed 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. - -# This script compiles manifest files with the image tags and places them in -# /release/... - -set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[[ -n "${DEBUG:-}" ]] && set -x - -log() { echo "$1" >&2; } - -TAG="${TAG:?TAG env variable must be specified}" -REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}" -OUT_DIR="${OUT_DIR:-${SCRIPTDIR}/../release}" - -print_license_header() { - cat "${SCRIPTDIR}/license_header.txt" - echo -} - -print_autogenerated_warning() { - cat< "${k8s_manifests_file}" - log "Written ${k8s_manifests_file}" - - istio_manifests_file="${OUT_DIR}/istio-manifests.yaml" - mk_istio_manifests > "${istio_manifests_file}" - log "Written ${istio_manifests_file}" -} - -main diff --git a/hack/make-release.sh b/hack/make-release.sh deleted file mode 100644 index 1dd16550b1..0000000000 --- a/hack/make-release.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 Google LLC -# -# Licensed 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. - -# This script creates a new release by: -# - 1. building/pushing images -# - 2. injecting tags into YAML manifests -# - 3. creating a new git tag -# - 4. pushing the tag/commit to main. - -set -euo pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -[[ -n "${DEBUG:-}" ]] && set -x - -log() { echo "$1" >&2; } -fail() { log "$1"; exit 1; } - -TAG="${TAG:?TAG env variable must be specified}" -REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified e.g. gcr.io\/google-samples\/microservices-demo}" - -if [[ "$TAG" != v* ]]; then - fail "\$TAG must start with 'v', e.g. v0.1.0 (got: $TAG)" -fi - -# build and push images -"${SCRIPTDIR}"/make-docker-images.sh - -# update yaml -"${SCRIPTDIR}"/make-release-artifacts.sh - -# create git release / push to new branch -git checkout -b "release/${TAG}" -git add "${SCRIPTDIR}/../release/" -git commit --allow-empty -m "Release $TAG" -log "Pushing k8s manifests to release/${TAG}..." -git tag "$TAG" -git push --set-upstream origin "release/${TAG}" -git push --tags - -log "Successfully tagged release $TAG." diff --git a/istio-manifests/allow-egress-googleapis.yaml b/istio-manifests/allow-egress-googleapis.yaml deleted file mode 100644 index 50410b2794..0000000000 --- a/istio-manifests/allow-egress-googleapis.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: networking.istio.io/v1alpha3 -kind: ServiceEntry -metadata: - name: allow-egress-googleapis -spec: - hosts: - - "accounts.google.com" # Used to get token - - "*.googleapis.com" - ports: - - number: 80 - protocol: HTTP - name: http - - number: 443 - protocol: HTTPS - name: https ---- -apiVersion: networking.istio.io/v1alpha3 -kind: ServiceEntry -metadata: - name: allow-egress-google-metadata -spec: - hosts: - - metadata.google.internal - addresses: - - 169.254.169.254 # GCE metadata server - ports: - - number: 80 - name: http - protocol: HTTP - - number: 443 - name: https - protocol: HTTPS diff --git a/istio-manifests/frontend-gateway.yaml b/istio-manifests/frontend-gateway.yaml deleted file mode 100644 index b3a1a64737..0000000000 --- a/istio-manifests/frontend-gateway.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: networking.istio.io/v1alpha3 -kind: Gateway -metadata: - name: frontend-gateway -spec: - selector: - istio: ingressgateway # use Istio default gateway implementation - servers: - - port: - number: 80 - name: http - protocol: HTTP - hosts: - - "*" ---- -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: frontend-ingress -spec: - hosts: - - "*" - gateways: - - frontend-gateway - http: - - route: - - destination: - host: frontend - port: - number: 80 diff --git a/istio-manifests/frontend.yaml b/istio-manifests/frontend.yaml deleted file mode 100644 index 23cd64832c..0000000000 --- a/istio-manifests/frontend.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: frontend -spec: - hosts: - - "frontend.default.svc.cluster.local" - http: - - route: - - destination: - host: frontend - port: - number: 80 diff --git a/kubernetes-manifests/README.md b/kubernetes-manifests/README.md deleted file mode 100644 index ed852b720b..0000000000 --- a/kubernetes-manifests/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# ./kubernetes-manifests - -:warning: Kubernetes manifests provided in this directory are not directly -deployable to a cluster. They are meant to be used with `skaffold` command to -insert the correct `image:` tags. - -Use the manifests in [/release](/release) directory which are configured with -pre-built public images. diff --git a/kubernetes-manifests/adservice.yaml b/kubernetes-manifests/adservice.yaml deleted file mode 100644 index 95bafd2ac5..0000000000 --- a/kubernetes-manifests/adservice.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: adservice -spec: - selector: - matchLabels: - app: adservice - template: - metadata: - labels: - app: adservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: adservice - ports: - - containerPort: 9555 - env: - - name: PORT - value: "9555" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=adservice,service.version=1.0.0" - resources: - requests: - cpu: 400m - memory: 360Mi - limits: - cpu: 600m - memory: 600Mi - readinessProbe: - initialDelaySeconds: 60 - periodSeconds: 15 - exec: - command: ["/bin/grpc_health_probe", "-addr=:9555"] - livenessProbe: - initialDelaySeconds: 60 - periodSeconds: 15 - exec: - command: ["/bin/grpc_health_probe", "-addr=:9555"] ---- -apiVersion: v1 -kind: Service -metadata: - name: adservice -spec: - type: ClusterIP - selector: - app: adservice - ports: - - name: grpc - port: 9555 - targetPort: 9555 diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml deleted file mode 100644 index ee1f93aa00..0000000000 --- a/kubernetes-manifests/cartservice.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: cartservice -spec: - selector: - matchLabels: - app: cartservice - template: - metadata: - labels: - app: cartservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: cartservice - ports: - - containerPort: 7070 - env: - - name: REDIS_ADDR - value: "redis-cart:6379" - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=cartservice,service.version=1.0.0" - resources: - requests: - cpu: 200m - memory: 64Mi - limits: - cpu: 300m - memory: 128Mi - readinessProbe: - initialDelaySeconds: 15 - exec: - command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] - livenessProbe: - initialDelaySeconds: 15 - periodSeconds: 10 - exec: - command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] ---- -apiVersion: v1 -kind: Service -metadata: - name: cartservice -spec: - type: ClusterIP - selector: - app: cartservice - ports: - - name: grpc - port: 7070 - targetPort: 7070 diff --git a/kubernetes-manifests/checkoutservice.yaml b/kubernetes-manifests/checkoutservice.yaml deleted file mode 100644 index c7b7b224cb..0000000000 --- a/kubernetes-manifests/checkoutservice.yaml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: checkoutservice -spec: - selector: - matchLabels: - app: checkoutservice - template: - metadata: - labels: - app: checkoutservice - spec: - serviceAccountName: default - containers: - - name: server - image: checkoutservice - ports: - - containerPort: 5050 - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:5050"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:5050"] - env: - - name: PORT - value: "5050" - - name: PRODUCT_CATALOG_SERVICE_ADDR - value: "productcatalogservice:3550" - - name: SHIPPING_SERVICE_ADDR - value: "shippingservice:50051" - - name: PAYMENT_SERVICE_ADDR - value: "paymentservice:50051" - - name: EMAIL_SERVICE_ADDR - value: "emailservice:5000" - - name: CURRENCY_SERVICE_ADDR - value: "currencyservice:7000" - - name: CART_SERVICE_ADDR - value: "cartservice:7070" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=checkoutservice,service.version=1.0.0" - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: checkoutservice -spec: - type: ClusterIP - selector: - app: checkoutservice - ports: - - name: grpc - port: 5050 - targetPort: 5050 diff --git a/kubernetes-manifests/currencyservice.yaml b/kubernetes-manifests/currencyservice.yaml deleted file mode 100644 index 0e1543405e..0000000000 --- a/kubernetes-manifests/currencyservice.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: currencyservice -spec: - selector: - matchLabels: - app: currencyservice - template: - metadata: - labels: - app: currencyservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: currencyservice - ports: - - name: grpc - containerPort: 7000 - env: - - name: PORT - value: "7000" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=currencyservice,service.version=1.0.0" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:7000"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:7000"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: currencyservice -spec: - type: ClusterIP - selector: - app: currencyservice - ports: - - name: grpc - port: 7000 - targetPort: 7000 diff --git a/kubernetes-manifests/emailservice.yaml b/kubernetes-manifests/emailservice.yaml deleted file mode 100644 index 9c3c1b7ca0..0000000000 --- a/kubernetes-manifests/emailservice.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: emailservice -spec: - selector: - matchLabels: - app: emailservice - template: - metadata: - labels: - app: emailservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: emailservice - ports: - - containerPort: 8080 - env: - - name: PORT - value: "8080" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=emailservice,service.version=1.0.0" - readinessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - livenessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: emailservice -spec: - type: ClusterIP - selector: - app: emailservice - ports: - - name: grpc - port: 5000 - targetPort: 8080 diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml deleted file mode 100644 index 43d65fc843..0000000000 --- a/kubernetes-manifests/frontend.yaml +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: frontend -spec: - selector: - matchLabels: - app: frontend - template: - metadata: - labels: - app: frontend - annotations: - sidecar.istio.io/rewriteAppHTTPProbers: "true" - spec: - serviceAccountName: default - containers: - - name: server - image: frontend - ports: - - containerPort: 8080 - readinessProbe: - initialDelaySeconds: 10 - httpGet: - path: "/_healthz" - port: 8080 - httpHeaders: - - name: "Cookie" - value: "shop_session-id=x-readiness-probe" - livenessProbe: - initialDelaySeconds: 10 - httpGet: - path: "/_healthz" - port: 8080 - httpHeaders: - - name: "Cookie" - value: "shop_session-id=x-liveness-probe" - env: - - name: PORT - value: "8080" - - name: PRODUCT_CATALOG_SERVICE_ADDR - value: "productcatalogservice:3550" - - name: CURRENCY_SERVICE_ADDR - value: "currencyservice:7000" - - name: CART_SERVICE_ADDR - value: "cartservice:7070" - - name: RECOMMENDATION_SERVICE_ADDR - value: "recommendationservice:8080" - - name: SHIPPING_SERVICE_ADDR - value: "shippingservice:50051" - - name: CHECKOUT_SERVICE_ADDR - value: "checkoutservice:5050" - - name: AD_SERVICE_ADDR - value: "adservice:9555" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=frontend,service.version=1.0.0" - # # ENV_PLATFORM: One of: local, gcp, aws, azure, onprem, alibaba - # # When not set, defaults to "local" unless running in GKE, otherwies auto-sets to gcp - # - name: ENV_PLATFORM - # value: "aws" - # - name: CYMBAL_BRANDING - # value: "true" - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend -spec: - type: ClusterIP - selector: - app: frontend - ports: - - name: http - port: 80 - targetPort: 8080 ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend-external -spec: - type: NodePort - selector: - app: frontend - ports: - - name: http - port: 80 - targetPort: 8080 diff --git a/kubernetes-manifests/jaeger.yaml b/kubernetes-manifests/jaeger.yaml deleted file mode 100644 index 3e2f32f676..0000000000 --- a/kubernetes-manifests/jaeger.yaml +++ /dev/null @@ -1,88 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: jaeger -spec: - selector: - matchLabels: - app: jaeger - template: - metadata: - labels: - app: jaeger - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: jaeger - image: jaegertracing/all-in-one:1.31 - env: - - name: COLLECTOR_ZIPKIN_HOST_PORT - value: ":9411" - ports: - - containerPort: 5775 - - containerPort: 6831 - - containerPort: 6832 - - containerPort: 5778 - - containerPort: 14250 - - containerPort: 14268 - - containerPort: 14269 - - containerPort: 16686 - - containerPort: 9411 - resources: - requests: - cpu: 200m - memory: 180Mi - limits: - cpu: 300m - memory: 300Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: jaeger -spec: - type: ClusterIP - selector: - app: jaeger - ports: - - name: "5775" - port: 5775 - targetPort: 5775 - protocol: UDP - - name: "6831" - port: 6831 - targetPort: 6831 - protocol: UDP - - name: "6832" - port: 6832 - targetPort: 6832 - protocol: UDP - - name: "5778" - port: 5778 - targetPort: 5778 - - name: "14250" - port: 14250 - targetPort: 14250 - - name: "14268" - port: 14268 - targetPort: 14268 - - name: "14269" - port: 14269 - targetPort: 14269 - - name: "9411" - port: 9411 - targetPort: 9411 ---- -apiVersion: v1 -kind: Service -metadata: - name: jaeger-frontend -spec: - type: NodePort - selector: - app: jaeger - ports: - - name: "16686" - port: 16686 - targetPort: 16686 diff --git a/kubernetes-manifests/loadgenerator.yaml b/kubernetes-manifests/loadgenerator.yaml deleted file mode 100644 index 7b53dc0736..0000000000 --- a/kubernetes-manifests/loadgenerator.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: loadgenerator -spec: - selector: - matchLabels: - app: loadgenerator - replicas: 1 - template: - metadata: - labels: - app: loadgenerator - annotations: - sidecar.istio.io/rewriteAppHTTPProbers: "true" - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - restartPolicy: Always - initContainers: - - command: - - /bin/sh - - -exc - - | - echo "Init container pinging frontend: ${FRONTEND_ADDR}..." - STATUSCODE=$(wget --server-response http://${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}') - if test $STATUSCODE -ne 200; then - echo "Error: Could not reach frontend - Status code: ${STATUSCODE}" - exit 1 - fi - name: frontend-check - image: busybox:latest - env: - - name: FRONTEND_ADDR - value: "frontend:80" - containers: - - name: main - image: loadgenerator - env: - - name: FRONTEND_ADDR - value: "frontend:80" - - name: USERS - value: "10" - resources: - requests: - cpu: 300m - memory: 256Mi - limits: - cpu: 500m - memory: 512Mi diff --git a/kubernetes-manifests/otelcollector.yaml b/kubernetes-manifests/otelcollector.yaml deleted file mode 100644 index da137e86e8..0000000000 --- a/kubernetes-manifests/otelcollector.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: otelcollector -spec: - selector: - matchLabels: - app: otelcollector - template: - metadata: - labels: - app: otelcollector - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: otelcollector - image: otelcollector - ports: - - containerPort: 1888 - - containerPort: 8888 - - containerPort: 8889 - - containerPort: 13133 - - containerPort: 4317 - - containerPort: 55670 - resources: - requests: - cpu: 200m - memory: 180Mi - limits: - cpu: 300m - memory: 300Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: otelcollector -spec: - type: ClusterIP - selector: - app: otelcollector - ports: - - name: "1888" - port: 1888 - targetPort: 1888 - - name: "8888" - port: 8888 - targetPort: 8888 - - name: "8889" - port: 8889 - targetPort: 8889 - - name: "13133" - port: 13133 - targetPort: 13133 - - name: "4317" - port: 4317 - targetPort: 4317 - - name: "55670" - port: 55670 - targetPort: 55670 diff --git a/kubernetes-manifests/paymentservice.yaml b/kubernetes-manifests/paymentservice.yaml deleted file mode 100644 index 140ce27a44..0000000000 --- a/kubernetes-manifests/paymentservice.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: paymentservice -spec: - selector: - matchLabels: - app: paymentservice - template: - metadata: - labels: - app: paymentservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: paymentservice - ports: - - containerPort: 50051 - env: - - name: PORT - value: "50051" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=paymentservice,service.version=1.0.0" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: paymentservice -spec: - type: ClusterIP - selector: - app: paymentservice - ports: - - name: grpc - port: 50051 - targetPort: 50051 diff --git a/kubernetes-manifests/productcatalogservice.yaml b/kubernetes-manifests/productcatalogservice.yaml deleted file mode 100644 index e1f65b05de..0000000000 --- a/kubernetes-manifests/productcatalogservice.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: productcatalogservice -spec: - selector: - matchLabels: - app: productcatalogservice - template: - metadata: - labels: - app: productcatalogservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: productcatalogservice - ports: - - containerPort: 3550 - env: - - name: PORT - value: "3550" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=productcatalogservice,service.version=1.0.0" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:3550"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:3550"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: productcatalogservice -spec: - type: ClusterIP - selector: - app: productcatalogservice - ports: - - name: grpc - port: 3550 - targetPort: 3550 diff --git a/kubernetes-manifests/recommendationservice.yaml b/kubernetes-manifests/recommendationservice.yaml deleted file mode 100644 index 5be856aa22..0000000000 --- a/kubernetes-manifests/recommendationservice.yaml +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: recommendationservice -spec: - selector: - matchLabels: - app: recommendationservice - template: - metadata: - labels: - app: recommendationservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: recommendationservice - ports: - - containerPort: 8080 - readinessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - livenessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - env: - - name: PORT - value: "8080" - - name: PRODUCT_CATALOG_SERVICE_ADDR - value: "productcatalogservice:3550" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=recommendationservice,service.version=1.0.0" - resources: - requests: - cpu: 100m - memory: 220Mi - limits: - cpu: 200m - memory: 450Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: recommendationservice -spec: - type: ClusterIP - selector: - app: recommendationservice - ports: - - name: grpc - port: 8080 - targetPort: 8080 diff --git a/kubernetes-manifests/redis.yaml b/kubernetes-manifests/redis.yaml deleted file mode 100644 index b67649b93b..0000000000 --- a/kubernetes-manifests/redis.yaml +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: redis-cart -spec: - selector: - matchLabels: - app: redis-cart - template: - metadata: - labels: - app: redis-cart - spec: - containers: - - name: redis - image: redis:alpine - ports: - - containerPort: 6379 - readinessProbe: - periodSeconds: 5 - tcpSocket: - port: 6379 - livenessProbe: - periodSeconds: 5 - tcpSocket: - port: 6379 - volumeMounts: - - mountPath: /data - name: redis-data - resources: - limits: - memory: 256Mi - cpu: 125m - requests: - cpu: 70m - memory: 200Mi - volumes: - - name: redis-data - emptyDir: {} ---- -apiVersion: v1 -kind: Service -metadata: - name: redis-cart -spec: - type: ClusterIP - selector: - app: redis-cart - ports: - - name: redis - port: 6379 - targetPort: 6379 diff --git a/kubernetes-manifests/shippingservice.yaml b/kubernetes-manifests/shippingservice.yaml deleted file mode 100644 index f389fdf589..0000000000 --- a/kubernetes-manifests/shippingservice.yaml +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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: shippingservice -spec: - selector: - matchLabels: - app: shippingservice - template: - metadata: - labels: - app: shippingservice - spec: - serviceAccountName: default - containers: - - name: server - image: shippingservice - ports: - - containerPort: 50051 - env: - - name: PORT - value: "50051" - - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - value: "http://otelcollector:4317" - - name: OTEL_RESOURCE_ATTRIBUTES - value: "service.name=shippingservice,service.version=1.0.0" - readinessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: shippingservice -spec: - type: ClusterIP - selector: - app: shippingservice - ports: - - name: grpc - port: 50051 - targetPort: 50051 diff --git a/release/istio-manifests.yaml b/release/istio-manifests.yaml deleted file mode 100644 index 4b32291783..0000000000 --- a/release/istio-manifests.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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. - -# ---------------------------------------------------------- -# WARNING: This file is autogenerated. Do not manually edit. -# ---------------------------------------------------------- - -apiVersion: networking.istio.io/v1alpha3 -kind: Gateway -metadata: - name: frontend-gateway -spec: - selector: - istio: ingressgateway # use Istio default gateway implementation - servers: - - port: - number: 80 - name: http - protocol: HTTP - hosts: - - "*" ---- -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: frontend-ingress -spec: - hosts: - - "*" - gateways: - - frontend-gateway - http: - - route: - - destination: - host: frontend - port: - number: 80 ---- -apiVersion: networking.istio.io/v1alpha3 -kind: ServiceEntry -metadata: - name: allow-egress-googleapis -spec: - hosts: - - "accounts.google.com" # Used to get token - - "*.googleapis.com" - ports: - - number: 80 - protocol: HTTP - name: http - - number: 443 - protocol: HTTPS - name: https ---- -apiVersion: networking.istio.io/v1alpha3 -kind: ServiceEntry -metadata: - name: allow-egress-google-metadata -spec: - hosts: - - metadata.google.internal - addresses: - - 169.254.169.254 # GCE metadata server - ports: - - number: 80 - name: http - protocol: HTTP - - number: 443 - name: https - protocol: HTTPS ---- -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: frontend -spec: - hosts: - - "frontend.default.svc.cluster.local" - http: - - route: - - destination: - host: frontend - port: - number: 80 ---- diff --git a/release/kubernetes-manifests.yaml b/release/kubernetes-manifests.yaml deleted file mode 100644 index 12007119b7..0000000000 --- a/release/kubernetes-manifests.yaml +++ /dev/null @@ -1,749 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed 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. - -# ---------------------------------------------------------- -# WARNING: This file is autogenerated. Do not manually edit. -# ---------------------------------------------------------- - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: emailservice -spec: - selector: - matchLabels: - app: emailservice - template: - metadata: - labels: - app: emailservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/emailservice:v0.3.6 - ports: - - containerPort: 8080 - env: - - name: PORT - value: "8080" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - readinessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - livenessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: emailservice -spec: - type: ClusterIP - selector: - app: emailservice - ports: - - name: grpc - port: 5000 - targetPort: 8080 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: checkoutservice -spec: - selector: - matchLabels: - app: checkoutservice - template: - metadata: - labels: - app: checkoutservice - spec: - serviceAccountName: default - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.3.6 - ports: - - containerPort: 5050 - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:5050"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:5050"] - env: - - name: PORT - value: "5050" - - name: PRODUCT_CATALOG_SERVICE_ADDR - value: "productcatalogservice:3550" - - name: SHIPPING_SERVICE_ADDR - value: "shippingservice:50051" - - name: PAYMENT_SERVICE_ADDR - value: "paymentservice:50051" - - name: EMAIL_SERVICE_ADDR - value: "emailservice:5000" - - name: CURRENCY_SERVICE_ADDR - value: "currencyservice:7000" - - name: CART_SERVICE_ADDR - value: "cartservice:7070" - - name: DISABLE_STATS - value: "1" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - # - name: JAEGER_SERVICE_ADDR - # value: "jaeger-collector:14268" - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: checkoutservice -spec: - type: ClusterIP - selector: - app: checkoutservice - ports: - - name: grpc - port: 5050 - targetPort: 5050 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: recommendationservice -spec: - selector: - matchLabels: - app: recommendationservice - template: - metadata: - labels: - app: recommendationservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.3.6 - ports: - - containerPort: 8080 - readinessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - livenessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - env: - - name: PORT - value: "8080" - - name: PRODUCT_CATALOG_SERVICE_ADDR - value: "productcatalogservice:3550" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - - name: DISABLE_DEBUGGER - value: "1" - resources: - requests: - cpu: 100m - memory: 220Mi - limits: - cpu: 200m - memory: 450Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: recommendationservice -spec: - type: ClusterIP - selector: - app: recommendationservice - ports: - - name: grpc - port: 8080 - targetPort: 8080 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: frontend -spec: - selector: - matchLabels: - app: frontend - template: - metadata: - labels: - app: frontend - annotations: - sidecar.istio.io/rewriteAppHTTPProbers: "true" - spec: - serviceAccountName: default - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/frontend:v0.3.6 - ports: - - containerPort: 8080 - readinessProbe: - initialDelaySeconds: 10 - httpGet: - path: "/_healthz" - port: 8080 - httpHeaders: - - name: "Cookie" - value: "shop_session-id=x-readiness-probe" - livenessProbe: - initialDelaySeconds: 10 - httpGet: - path: "/_healthz" - port: 8080 - httpHeaders: - - name: "Cookie" - value: "shop_session-id=x-liveness-probe" - env: - - name: PORT - value: "8080" - - name: PRODUCT_CATALOG_SERVICE_ADDR - value: "productcatalogservice:3550" - - name: CURRENCY_SERVICE_ADDR - value: "currencyservice:7000" - - name: CART_SERVICE_ADDR - value: "cartservice:7070" - - name: RECOMMENDATION_SERVICE_ADDR - value: "recommendationservice:8080" - - name: SHIPPING_SERVICE_ADDR - value: "shippingservice:50051" - - name: CHECKOUT_SERVICE_ADDR - value: "checkoutservice:5050" - - name: AD_SERVICE_ADDR - value: "adservice:9555" - # # ENV_PLATFORM: One of: local, gcp, aws, azure, onprem, alibaba - # # When not set, defaults to "local" unless running in GKE, otherwies auto-sets to gcp - # - name: ENV_PLATFORM - # value: "aws" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - # - name: JAEGER_SERVICE_ADDR - # value: "jaeger-collector:14268" - # - name: CYMBAL_BRANDING - # value: "true" - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend -spec: - type: ClusterIP - selector: - app: frontend - ports: - - name: http - port: 80 - targetPort: 8080 ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend-external -spec: - type: LoadBalancer - selector: - app: frontend - ports: - - name: http - port: 80 - targetPort: 8080 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: paymentservice -spec: - selector: - matchLabels: - app: paymentservice - template: - metadata: - labels: - app: paymentservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/paymentservice:v0.3.6 - ports: - - containerPort: 50051 - env: - - name: PORT - value: "50051" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - - name: DISABLE_DEBUGGER - value: "1" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: paymentservice -spec: - type: ClusterIP - selector: - app: paymentservice - ports: - - name: grpc - port: 50051 - targetPort: 50051 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: productcatalogservice -spec: - selector: - matchLabels: - app: productcatalogservice - template: - metadata: - labels: - app: productcatalogservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.3.6 - ports: - - containerPort: 3550 - env: - - name: PORT - value: "3550" - - name: DISABLE_STATS - value: "1" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - # - name: JAEGER_SERVICE_ADDR - # value: "jaeger-collector:14268" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:3550"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:3550"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: productcatalogservice -spec: - type: ClusterIP - selector: - app: productcatalogservice - ports: - - name: grpc - port: 3550 - targetPort: 3550 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: cartservice -spec: - selector: - matchLabels: - app: cartservice - template: - metadata: - labels: - app: cartservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/cartservice:v0.3.6 - ports: - - containerPort: 7070 - env: - - name: REDIS_ADDR - value: "redis-cart:6379" - resources: - requests: - cpu: 200m - memory: 64Mi - limits: - cpu: 300m - memory: 128Mi - readinessProbe: - initialDelaySeconds: 15 - exec: - command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] - livenessProbe: - initialDelaySeconds: 15 - periodSeconds: 10 - exec: - command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] ---- -apiVersion: v1 -kind: Service -metadata: - name: cartservice -spec: - type: ClusterIP - selector: - app: cartservice - ports: - - name: grpc - port: 7070 - targetPort: 7070 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: loadgenerator -spec: - selector: - matchLabels: - app: loadgenerator - replicas: 1 - template: - metadata: - labels: - app: loadgenerator - annotations: - sidecar.istio.io/rewriteAppHTTPProbers: "true" - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - restartPolicy: Always - initContainers: - - command: - - /bin/sh - - -exc - - | - echo "Init container pinging frontend: ${FRONTEND_ADDR}..." - STATUSCODE=$(wget --server-response http://${FRONTEND_ADDR} 2>&1 | awk '/^ HTTP/{print $2}') - if test $STATUSCODE -ne 200; then - echo "Error: Could not reach frontend - Status code: ${STATUSCODE}" - exit 1 - fi - name: frontend-check - image: busybox:latest - env: - - name: FRONTEND_ADDR - value: "frontend:80" - containers: - - name: main - image: gcr.io/google-samples/microservices-demo/loadgenerator:v0.3.6 - env: - - name: FRONTEND_ADDR - value: "frontend:80" - - name: USERS - value: "10" - resources: - requests: - cpu: 300m - memory: 256Mi - limits: - cpu: 500m - memory: 512Mi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: currencyservice -spec: - selector: - matchLabels: - app: currencyservice - template: - metadata: - labels: - app: currencyservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/currencyservice:v0.3.6 - ports: - - name: grpc - containerPort: 7000 - env: - - name: PORT - value: "7000" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - - name: DISABLE_DEBUGGER - value: "1" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:7000"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:7000"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: currencyservice -spec: - type: ClusterIP - selector: - app: currencyservice - ports: - - name: grpc - port: 7000 - targetPort: 7000 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: shippingservice -spec: - selector: - matchLabels: - app: shippingservice - template: - metadata: - labels: - app: shippingservice - spec: - serviceAccountName: default - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/shippingservice:v0.3.6 - ports: - - containerPort: 50051 - env: - - name: PORT - value: "50051" - - name: DISABLE_STATS - value: "1" - - name: DISABLE_TRACING - value: "1" - - name: DISABLE_PROFILER - value: "1" - # - name: JAEGER_SERVICE_ADDR - # value: "jaeger-collector:14268" - readinessProbe: - periodSeconds: 5 - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:50051"] - resources: - requests: - cpu: 100m - memory: 64Mi - limits: - cpu: 200m - memory: 128Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: shippingservice -spec: - type: ClusterIP - selector: - app: shippingservice - ports: - - name: grpc - port: 50051 - targetPort: 50051 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-cart -spec: - selector: - matchLabels: - app: redis-cart - template: - metadata: - labels: - app: redis-cart - spec: - containers: - - name: redis - image: redis:alpine - ports: - - containerPort: 6379 - readinessProbe: - periodSeconds: 5 - tcpSocket: - port: 6379 - livenessProbe: - periodSeconds: 5 - tcpSocket: - port: 6379 - volumeMounts: - - mountPath: /data - name: redis-data - resources: - limits: - memory: 256Mi - cpu: 125m - requests: - cpu: 70m - memory: 200Mi - volumes: - - name: redis-data - emptyDir: {} ---- -apiVersion: v1 -kind: Service -metadata: - name: redis-cart -spec: - type: ClusterIP - selector: - app: redis-cart - ports: - - name: redis - port: 6379 - targetPort: 6379 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: adservice -spec: - selector: - matchLabels: - app: adservice - template: - metadata: - labels: - app: adservice - spec: - serviceAccountName: default - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: gcr.io/google-samples/microservices-demo/adservice:v0.3.6 - ports: - - containerPort: 9555 - env: - - name: PORT - value: "9555" - - name: DISABLE_STATS - value: "1" - - name: DISABLE_TRACING - value: "1" - # - name: JAEGER_SERVICE_ADDR - # value: "jaeger-collector:14268" - resources: - requests: - cpu: 200m - memory: 180Mi - limits: - cpu: 300m - memory: 300Mi - readinessProbe: - initialDelaySeconds: 20 - periodSeconds: 15 - exec: - command: ["/bin/grpc_health_probe", "-addr=:9555"] - livenessProbe: - initialDelaySeconds: 20 - periodSeconds: 15 - exec: - command: ["/bin/grpc_health_probe", "-addr=:9555"] ---- -apiVersion: v1 -kind: Service -metadata: - name: adservice -spec: - type: ClusterIP - selector: - app: adservice - ports: - - name: grpc - port: 9555 - targetPort: 9555 ---- diff --git a/skaffold.yaml b/skaffold.yaml deleted file mode 100644 index 51ef33706e..0000000000 --- a/skaffold.yaml +++ /dev/null @@ -1,111 +0,0 @@ -# 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. -# 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: skaffold/v2beta18 -kind: Config -metadata: - name: app -build: - artifacts: - # image tags are relative; to specify an image repo (e.g. GCR), you - # must provide a "default repo" using one of the methods described - # here: - # https://skaffold.dev/docs/concepts/#image-repository-handling - - image: emailservice - context: src/emailservice - - image: productcatalogservice - context: src/productcatalogservice - - image: recommendationservice - context: src/recommendationservice - - image: shippingservice - context: src/shippingservice - - image: checkoutservice - context: src/checkoutservice - - image: paymentservice - context: src/paymentservice - - image: currencyservice - context: src/currencyservice - - image: cartservice - context: src/cartservice/src - docker: - dockerfile: Dockerfile - - image: frontend - context: src/frontend - - image: adservice - context: src/adservice - - image: otelcollector - context: src/otelcollector - tagPolicy: - gitCommit: {} - local: - useBuildkit: false -deploy: - kubectl: - manifests: - - ./kubernetes-manifests/adservice.yaml - - ./kubernetes-manifests/cartservice.yaml - - ./kubernetes-manifests/checkoutservice.yaml - - ./kubernetes-manifests/currencyservice.yaml - - ./kubernetes-manifests/emailservice.yaml - - ./kubernetes-manifests/frontend.yaml - - ./kubernetes-manifests/jaeger.yaml - - ./kubernetes-manifests/otelcollector.yaml - - ./kubernetes-manifests/paymentservice.yaml - - ./kubernetes-manifests/productcatalogservice.yaml - - ./kubernetes-manifests/recommendationservice.yaml - - ./kubernetes-manifests/redis.yaml - - ./kubernetes-manifests/shippingservice.yaml -profiles: -# "gcb" profile allows building and pushing the images -# on Google Container Builder without requiring docker -# installed on the developer machine. However, note that -# since GCB does not cache the builds, each build will -# start from scratch and therefore take a long time. -# -# This is not used by default. To use it, run: -# skaffold run -p gcb -- name: gcb - build: - googleCloudBuild: - diskSizeGb: 300 - machineType: N1_HIGHCPU_32 - timeout: 4000s -# "debug" profile replaces the default Dockerfile in cartservice with Dockerfile.debug, -# which enables debugging via skaffold. -# -# This profile is used by default when running skaffold debug. -- name: debug - activation: - - command: debug - patches: - - op: replace - path: /build/artifacts/7/docker/dockerfile - value: Dockerfile.debug - ---- - -apiVersion: skaffold/v2beta18 -kind: Config -metadata: - name: loadgenerator -requires: - - configs: [app] -build: - artifacts: - - image: loadgenerator - context: src/loadgenerator -deploy: - kubectl: - manifests: - - ./kubernetes-manifests/loadgenerator.yaml From 77bda571cc43aaf05d95bc59d3547ecac317a4e1 Mon Sep 17 00:00:00 2001 From: cartersocha Date: Tue, 17 May 2022 13:12:47 -0700 Subject: [PATCH 3/6] fix markdown lint --- README.md | 8 +------- src/adservice/README.md | 15 ++++++++------ src/checkoutservice/README.md | 4 +++- src/frontend/README.md | 4 +++- src/productcatalogservice/README.md | 31 +++++++++++++++++------------ src/shippingservice/README.md | 11 ++++++---- 6 files changed, 41 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index c0aefa8c2c..a1a6f91831 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,5 @@ # Webstore Demo -

-Online Boutique -

- ---- - ## Under Construction This repo is a work in progress @@ -57,7 +51,7 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb). Microservices use a high volume of gRPC calls to communicate to each other. - **[OpenTelemetry Traces](https://opentelemetry.io):** All services are instrumented using OpenTelemetry available instrumentation libraries. -- **[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/getting-started):** +- **[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/getting-started):** All services are instrumented and sending the generated traces to the OpenTelemetry Collector via gRPC. The received traces are then exported to the logs and to Jaeger. diff --git a/src/adservice/README.md b/src/adservice/README.md index 599dbb7fb1..d6a2705de4 100644 --- a/src/adservice/README.md +++ b/src/adservice/README.md @@ -1,20 +1,24 @@ # Ad Service -The Ad service provides advertisement based on context keys. If no context keys are provided then it returns random ads. +The Ad service provides advertisement based on context keys. If no context keys +are provided then it returns random ads. ## Building locally -The Ad service uses gradlew to compile/install/distribute. Gradle wrapper is already part of the source code. To build Ad Service, run: +The Ad service uses gradlew to compile/install/distribute. Gradle wrapper is +already part of the source code. To build Ad Service, run: -``` +```sh ./gradlew installDist ``` + It will create executable script src/adservice/build/install/hipstershop/bin/AdService ### Upgrading gradle version + If you need to upgrade the version of gradle then run -``` +```sh ./gradlew wrapper --gradle-version ``` @@ -22,7 +26,6 @@ If you need to upgrade the version of gradle then run From `src/adservice/`, run: -``` +```sh docker build ./ ``` - diff --git a/src/checkoutservice/README.md b/src/checkoutservice/README.md index 297f51d769..922d3eb436 100644 --- a/src/checkoutservice/README.md +++ b/src/checkoutservice/README.md @@ -2,4 +2,6 @@ Run the following command to restore dependencies to `vendor/` directory: - dep ensure --vendor-only +```sh +dep ensure --vendor-only +``` diff --git a/src/frontend/README.md b/src/frontend/README.md index 4e8f725916..65bc2ed98c 100644 --- a/src/frontend/README.md +++ b/src/frontend/README.md @@ -2,4 +2,6 @@ Run the following command to restore dependencies to `vendor/` directory: - dep ensure --vendor-only +```sh +dep ensure --vendor-only +``` diff --git a/src/productcatalogservice/README.md b/src/productcatalogservice/README.md index 5dc8fea449..3503d24cb3 100644 --- a/src/productcatalogservice/README.md +++ b/src/productcatalogservice/README.md @@ -2,14 +2,16 @@ Run the following command to restore dependencies to `vendor/` directory: - dep ensure --vendor-only +```sh +dep ensure --vendor-only +``` ## Dynamic catalog reloading / artificial delay -This service has a "dynamic catalog reloading" feature that is purposefully -not well implemented. The goal of this feature is to allow you to modify the -`products.json` file and have the changes be picked up without having to -restart the service. +This service has a "dynamic catalog reloading" feature that is purposefully not +well implemented. The goal of this feature is to allow you to modify the +`products.json` file and have the changes be picked up without having to restart +the service. However, this feature is bugged: the catalog is actually reloaded on each request, introducing a noticeable delay in the frontend. This delay will also @@ -19,20 +21,23 @@ of the CPU time. You can trigger this feature (and the delay) by sending a `USR1` signal and remove it (if needed) by sending a `USR2` signal: -``` +```sh # Trigger bug kubectl exec \ - $(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \ - -c server -- kill -USR1 1 +$(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \ +-c server -- kill -USR1 1 # Remove bug kubectl exec \ - $(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \ - -c server -- kill -USR2 1 +$(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \ +-c server -- kill -USR2 1 ``` ## Latency injection -This service has an `EXTRA_LATENCY` environment variable. This will inject a sleep for the specified [time.Duration](https://golang.org/pkg/time/#ParseDuration) on every call to -to the server. +This service has an `EXTRA_LATENCY` environment variable. This will inject a +sleep for the specified +[time.Duration](https://golang.org/pkg/time/#ParseDuration) on every call to to +the server. -For example, use `EXTRA_LATENCY="5.5s"` to sleep for 5.5 seconds on every request. +For example, use `EXTRA_LATENCY="5.5s"` to sleep for 5.5 seconds on every +request. diff --git a/src/shippingservice/README.md b/src/shippingservice/README.md index cbbfdaa18e..f7eadf9648 100644 --- a/src/shippingservice/README.md +++ b/src/shippingservice/README.md @@ -1,23 +1,26 @@ # Shipping Service -The Shipping service provides price quote, tracking IDs, and the impression of order fulfillment & shipping processes. +The Shipping service provides price quote, tracking IDs, and the impression of +order fulfillment & shipping processes. ## Local Run the following command to restore dependencies to `vendor/` directory: - dep ensure --vendor-only +```sh +dep ensure --vendor-only +``` ## Build From `src/shippingservice`, run: -``` +```sh docker build ./ ``` ## Test -``` +```sh go test . ``` From 050894077c5220d05803b84867f91de41636a42a Mon Sep 17 00:00:00 2001 From: cartersocha Date: Tue, 17 May 2022 13:18:47 -0700 Subject: [PATCH 4/6] add readmes. Fix broken links --- README.md | 24 ++++++++++++------------ pb/README.md | 3 +++ src/cartservice/README.md | 3 +++ src/currencyservice/README.md | 3 +++ src/emailservice/README.md | 3 +++ src/loadgenerator/README.md | 3 +++ src/otelcollector/README.md | 3 +++ src/paymentservice/README.md | 3 +++ src/recommendationservice/README.md | 3 +++ 9 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 pb/README.md create mode 100644 src/cartservice/README.md create mode 100644 src/currencyservice/README.md create mode 100644 src/emailservice/README.md create mode 100644 src/loadgenerator/README.md create mode 100644 src/otelcollector/README.md create mode 100644 src/paymentservice/README.md create mode 100644 src/recommendationservice/README.md diff --git a/README.md b/README.md index a1a6f91831..c08d933d13 100644 --- a/README.md +++ b/README.md @@ -25,21 +25,21 @@ See the [Development Principles](/docs/development-principles.md) doc for more i [![Architecture of microservices](./docs/img/architecture-diagram.png)](./docs/img/architecture-diagram.png) -Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb). +Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb/README.md). | Service | Language | Description | | ---------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| [frontend](./src/frontend) | Go | Exposes an HTTP server to serve the website. Does not require signup/login and generates session IDs for all users automatically. | -| [cartservice](./src/cartservice) | C# | Stores the items in the user's shopping cart in Redis and retrieves it. | -| [productcatalogservice](./src/productcatalogservice) | Go | Provides the list of products from a JSON file and ability to search products and get individual products. | -| [currencyservice](./src/currencyservice) | Node.js | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. | -| [paymentservice](./src/paymentservice) | Node.js | Charges the given credit card info (mock) with the given amount and returns a transaction ID. | -| [shippingservice](./src/shippingservice) | Go | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) | -| [emailservice](./src/emailservice) | Python | Sends users an order confirmation email (mock). | -| [checkoutservice](./src/checkoutservice) | Go | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. | -| [recommendationservice](./src/recommendationservice) | Python | Recommends other products based on what's given in the cart. | -| [adservice](./src/adservice) | Java | Provides text ads based on given context words. | -| [loadgenerator](./src/loadgenerator) | Python/Locust | Continuously sends requests imitating realistic user shopping flows to the frontend. | +| [frontend](./src/frontend/README.md) | Go | Exposes an HTTP server to serve the website. Does not require signup/login and generates session IDs for all users automatically. | +| [cartservice](./src/cartservice/README.md) | C# | Stores the items in the user's shopping cart in Redis and retrieves it. | +| [productcatalogservice](./src/productcatalogservice/README.md) | Go | Provides the list of products from a JSON file and ability to search products and get individual products. | +| [currencyservice](./src/currencyservice/README.md) | Node.js | Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. | +| [paymentservice](./src/paymentservice/README.md) | Node.js | Charges the given credit card info (mock) with the given amount and returns a transaction ID. | +| [shippingservice](./src/shippingservice/README.md) | Go | Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) | +| [emailservice](./src/emailservice/README.md) | Python | Sends users an order confirmation email (mock). | +| [checkoutservice](./src/checkoutservice/README.md) | Go | Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. | +| [recommendationservice](./src/recommendationservice/README.md) | Python | Recommends other products based on what's given in the cart. | +| [adservice](./src/adservice/README.md) | Java | Provides text ads based on given context words. | +| [loadgenerator](./src/loadgenerator/README.md) | Python/Locust | Continuously sends requests imitating realistic user shopping flows to the frontend. | ## Features diff --git a/pb/README.md b/pb/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/pb/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/cartservice/README.md b/src/cartservice/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/cartservice/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/currencyservice/README.md b/src/currencyservice/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/currencyservice/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/emailservice/README.md b/src/emailservice/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/emailservice/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/loadgenerator/README.md b/src/loadgenerator/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/loadgenerator/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/otelcollector/README.md b/src/otelcollector/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/otelcollector/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/paymentservice/README.md b/src/paymentservice/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/paymentservice/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder diff --git a/src/recommendationservice/README.md b/src/recommendationservice/README.md new file mode 100644 index 0000000000..1cb920bac8 --- /dev/null +++ b/src/recommendationservice/README.md @@ -0,0 +1,3 @@ +# Read Me + +This is a placeholder From d14dfd781cfc9ac23022c13d4c7c622a7ec7a29e Mon Sep 17 00:00:00 2001 From: cartersocha Date: Tue, 17 May 2022 14:34:46 -0700 Subject: [PATCH 5/6] fix yaml lint --- src/otelcollector/conf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/otelcollector/conf.yml b/src/otelcollector/conf.yml index 2ce58ff50a..032fab82f4 100644 --- a/src/otelcollector/conf.yml +++ b/src/otelcollector/conf.yml @@ -17,4 +17,4 @@ service: traces: receivers: [otlp] processors: [] - exporters: [logging,jaeger] + exporters: [logging, jaeger] From 9586db1367a53fae883ec13020303d4b4b39ca0b Mon Sep 17 00:00:00 2001 From: cartersocha Date: Tue, 17 May 2022 16:10:38 -0700 Subject: [PATCH 6/6] update changelog for donation blurb --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e16d093a04..3ce29cbe04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,3 +6,10 @@ content of "Unreleased" section content will generate release notes for the release. ## Unreleased + +* The initial code base is donated from a + [fork](https://github.com/julianocosta89/opentelemetry-microservices-demo) of + the [Google microservices + demo](https://github.com/GoogleCloudPlatform/microservices-demo) with express + knowledge of the owners. The pre-existing copyrights will remain. Any + future significant modifications will be credited to OpenTelemetry Authors.